From: BobHanson Date: Tue, 2 Jun 2020 15:20:30 +0000 (-0500) Subject: JAL-3446 JAL-3253 Preferences X-Git-Url: http://source.jalview.org/gitweb/?a=commitdiff_plain;h=733475a7d1f0fddcb059dd45cd8ef8cf0acd8ecc;p=jalview.git JAL-3446 JAL-3253 Preferences - unnecessary static initialization of StructureViewer --- 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; }