SliderPanel pid = null;
if (PIDSlider == null)
{
- pid = new SliderPanel(ap, 50, false, cs);
+ pid = new SliderPanel(ap, cs.getThreshold(), false, cs);
PIDSlider = new Frame();
PIDSlider.add(pid);
}
}
+ /**
+ * Hides the PID slider panel if it is shown
+ */
public static void hidePIDSlider()
{
- PIDSlider.setVisible(false);
- PIDSlider = null;
+ if (PIDSlider != null)
+ {
+ PIDSlider.setVisible(false);
+ PIDSlider = null;
+ }
}
+ /**
+ * Hides the conservation slider panel if it is shown
+ */
public static void hideConservationSlider()
{
- conservationSlider.setVisible(false);
- conservationSlider = null;
+ if (conservationSlider != null)
+ {
+ conservationSlider.setVisible(false);
+ conservationSlider = null;
+ }
}
public SliderPanel(AlignmentPanel ap, int value, boolean forConserve,
ColourSchemeI cs)
import javax.swing.JLayeredPane;
import javax.swing.event.ChangeEvent;
import javax.swing.event.ChangeListener;
+import javax.swing.event.InternalFrameAdapter;
+import javax.swing.event.InternalFrameEvent;
/**
* DOCUMENT ME!
else
{
sp = (SliderPanel) conservationSlider.getContentPane();
+ sp.slider.setValue(cs.getConservationInc());
sp.cs = cs;
}
return sp.getValue();
}
+ /**
+ * Hides the PID slider panel if it is shown
+ */
public static void hidePIDSlider()
{
- try
- {
- PIDSlider.setClosed(true);
- PIDSlider = null;
- } catch (PropertyVetoException ex)
+ if (PIDSlider != null)
{
+ try
+ {
+ PIDSlider.setClosed(true);
+ PIDSlider = null;
+ } catch (PropertyVetoException ex)
+ {
+ }
}
}
+ /**
+ * Hides the conservation slider panel if it is shown
+ */
public static void hideConservationSlider()
{
- try
- {
- conservationSlider.setClosed(true);
- conservationSlider = null;
- } catch (PropertyVetoException ex)
+ if (conservationSlider != null)
{
+ try
+ {
+ conservationSlider.setClosed(true);
+ conservationSlider = null;
+ } catch (PropertyVetoException ex)
+ {
+ }
}
}
*/
public static void showConservationSlider()
{
- try
- {
- PIDSlider.setClosed(true);
- PIDSlider = null;
- } catch (Exception ex)
- {
- }
+ hidePIDSlider();
if (!conservationSlider.isVisible())
{
Desktop.addInternalFrame(conservationSlider,
conservationSlider.getTitle(), 420, 90, false);
conservationSlider
- .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
+ .addInternalFrameListener(new InternalFrameAdapter()
{
@Override
- public void internalFrameClosed(
- javax.swing.event.InternalFrameEvent e)
+ public void internalFrameClosed(InternalFrameEvent e)
{
conservationSlider = null;
}
else
{
pid = (SliderPanel) PIDSlider.getContentPane();
+ pid.slider.setValue(cs.getThreshold());
pid.cs = cs;
}
*/
public static void showPIDSlider()
{
- try
- {
- conservationSlider.setClosed(true);
- conservationSlider = null;
- } catch (Exception ex)
- {
- }
+ hideConservationSlider();
if (!PIDSlider.isVisible())
{
Desktop.addInternalFrame(PIDSlider, PIDSlider.getTitle(), 420, 90,
false);
PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
- PIDSlider
- .addInternalFrameListener(new javax.swing.event.InternalFrameAdapter()
- {
- @Override
- public void internalFrameClosed(
- javax.swing.event.InternalFrameEvent e)
- {
- PIDSlider = null;
- }
- });
+ PIDSlider.addInternalFrameListener(new InternalFrameAdapter()
+ {
+ @Override
+ public void internalFrameClosed(InternalFrameEvent e)
+ {
+ PIDSlider = null;
+ }
+ });
PIDSlider.setLayer(JLayeredPane.PALETTE_LAYER);
}
}