From 733475a7d1f0fddcb059dd45cd8ef8cf0acd8ecc Mon Sep 17 00:00:00 2001 From: BobHanson Date: Tue, 2 Jun 2020 10:20:30 -0500 Subject: [PATCH] JAL-3446 JAL-3253 Preferences - unnecessary static initialization of StructureViewer --- src/jalview/gui/Preferences.java | 5 ++++- src/jalview/jbgui/GPreferences.java | 31 +++++++++++++++++-------------- 2 files changed, 21 insertions(+), 15 deletions(-) diff --git a/src/jalview/gui/Preferences.java b/src/jalview/gui/Preferences.java index de67768..55345e0 100755 --- a/src/jalview/gui/Preferences.java +++ b/src/jalview/gui/Preferences.java @@ -444,8 +444,11 @@ public class Preferences extends GPreferences addSecondaryStructure.setEnabled(structSelected); addTempFactor.setSelected(Cache.getDefault(ADD_TEMPFACT_ANN, false)); addTempFactor.setEnabled(structSelected); - structViewer.setSelectedItem( + if (!Platform.isJS()) + { + structViewer.setSelectedItem( Cache.getDefault(STRUCTURE_DISPLAY, ViewerType.JMOL.name())); + } chimeraPath.setText(Cache.getDefault(CHIMERA_PATH, "")); chimeraPath.addActionListener(new ActionListener() { diff --git a/src/jalview/jbgui/GPreferences.java b/src/jalview/jbgui/GPreferences.java index 6de3888..60f17ab 100755 --- a/src/jalview/jbgui/GPreferences.java +++ b/src/jalview/jbgui/GPreferences.java @@ -1284,20 +1284,23 @@ public class GPreferences extends JPanel viewerLabel.setBounds(new Rectangle(10, ypos, 200, height)); structureTab.add(viewerLabel); - structViewer.setFont(LABEL_FONT); - structViewer.setBounds(new Rectangle(160, ypos, 120, height)); - structViewer.addItem(ViewerType.JMOL.name()); - structViewer.addItem(ViewerType.CHIMERA.name()); - structViewer.addActionListener(new ActionListener() + if (!Platform.isJS()) { - @Override - public void actionPerformed(ActionEvent e) + structViewer.setFont(LABEL_FONT); + structViewer.setBounds(new Rectangle(160, ypos, 120, height)); + structViewer.addItem(ViewerType.JMOL.name()); + structViewer.addItem(ViewerType.CHIMERA.name()); + structViewer.addActionListener(new ActionListener() { - structureViewer_actionPerformed( - (String) structViewer.getSelectedItem()); - } - }); - structureTab.add(structViewer); + @Override + public void actionPerformed(ActionEvent e) + { + structureViewer_actionPerformed( + (String) structViewer.getSelectedItem()); + } + }); + structureTab.add(structViewer); + } ypos += lineSpacing; JLabel pathLabel = new JLabel(); @@ -1360,14 +1363,14 @@ public class GPreferences extends JPanel /* * hide Chimera options in JalviewJS */ - if (Platform.isJS()) + if (Platform.isJS()) { pathLabel.setVisible(false); chimeraPath.setVisible(false); viewerLabel.setVisible(false); structViewer.setVisible(false); } - + return structureTab; } -- 1.7.10.2