JAL-2383 check for null, spelling
[jalview.git] / src / jalview / appletgui / SliderPanel.java
index 5ee665a..ec64b3b 100644 (file)
@@ -125,7 +125,7 @@ public class SliderPanel extends Panel implements ActionListener,
     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);
     }
@@ -178,16 +178,28 @@ public class SliderPanel extends Panel implements ActionListener,
 
   }
 
+  /**
+   * 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)