From 6efcc6b872e24abc34363d37577eac99a8756614 Mon Sep 17 00:00:00 2001 From: Jim Procter Date: Fri, 13 Oct 2017 17:27:57 +0100 Subject: [PATCH] JAL-2777 noticed exception raised on construction of feature settings because transparency slider 'setMax' triggers a repaint --- src/jalview/gui/FeatureSettings.java | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/jalview/gui/FeatureSettings.java b/src/jalview/gui/FeatureSettings.java index 0963b31..151ae9b 100644 --- a/src/jalview/gui/FeatureSettings.java +++ b/src/jalview/gui/FeatureSettings.java @@ -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); + } } }); -- 1.7.10.2