JAL-2777 noticed exception raised on construction of feature settings because transpa...
authorJim Procter <jprocter@issues.jalview.org>
Fri, 13 Oct 2017 16:27:57 +0000 (17:27 +0100)
committerJim Procter <jprocter@issues.jalview.org>
Tue, 17 Oct 2017 13:19:29 +0000 (14:19 +0100)
src/jalview/gui/FeatureSettings.java

index 0963b31..151ae9b 100644 (file)
@@ -131,6 +131,11 @@ public class FeatureSettings extends JPanel
   private static final int MIN_WIDTH = 400;
 
   private static final int MIN_HEIGHT = 400;
+  
+  /**
+   * when true, constructor is still executing - so ignore UI events
+   */
+  protected volatile boolean inConstruction = true;
 
   /**
    * Constructor
@@ -303,6 +308,7 @@ public class FeatureSettings extends JPanel
               };
             });
     frame.setLayer(JLayeredPane.PALETTE_LAYER);
+    inConstruction = false;
   }
 
   protected void popupSort(final int selectedRow, final String type,
@@ -1238,7 +1244,11 @@ public class FeatureSettings extends JPanel
       public void stateChanged(ChangeEvent evt)
       {
         fr.setTransparency((100 - transparency.getValue()) / 100f);
+        if (!inConstruction)
+        {
+          fr.setTransparency((100 - transparency.getValue()) / 100f);
         af.alignPanel.paintAlignment(true);
+        }
       }
     });