Revision: 20507 http://sourceforge.net/p/jmol/code/20507 Author: hansonr Date: 2015-05-19 00:14:46 +0000 (Tue, 19 May 2015) Log Message: ----------- 1.6-compatible switch replacement
Modified Paths: -------------- branches/nbo/Jmol/src/org/openscience/jmol/app/nbo/NBODialog.java Modified: branches/nbo/Jmol/src/org/openscience/jmol/app/nbo/NBODialog.java =================================================================== --- branches/nbo/Jmol/src/org/openscience/jmol/app/nbo/NBODialog.java 2015-05-18 22:24:12 UTC (rev 20506) +++ branches/nbo/Jmol/src/org/openscience/jmol/app/nbo/NBODialog.java 2015-05-19 00:14:46 UTC (rev 20507) @@ -424,62 +424,61 @@ return edit; } + /** * model selection panel + * * @return */ - private SPanel modelS(){ + private SPanel modelS() { SPanel p = new SPanel(); //p.setPreferredSize(new Dimension(p.getParent().getWidth()/3,p.getParent().getHeight()-50)); p.setBackground(Color.WHITE); - p.setLayout(new GridLayout(9,1,10,40)); - + p.setLayout(new GridLayout(9, 1, 10, 40)); + JTextPane txt = new JTextPane(); txt.setText("Select Model"); p.add(txt); - - String[] useOp = {"Formula","File"}; + + String[] useOp = { "Formula", "File" }; final JComboBox<String> use = new JComboBox<String>(useOp); //use.setPreferredSize(new Dimension(30,20)); Box box = Box.createHorizontalBox(); box.add(use); final JTextField folder = new JTextField(); - + box.add(folder); p.add(box); - + JButton b = new JButton("Generate Model"); - b.addActionListener( - new ActionListener(){ - @Override - public void actionPerformed(ActionEvent e){ - switch((String)use.getSelectedItem()){ - case "Formula":{ - try { - writeToFile("CMD show "+folder.getText().toUpperCase()); - rawCmd("<"+cmdFile+">"); - s2.setVisible(true); - } catch (IOException e1) { - // TODO - } - break; - }case "File":{ - try { - writeToFile("CMD use.a "+ folder.getText()); - rawCmd("<"+cmdFile+">"); - } catch (IOException e1) { - // TODO - } - } - } - }} - ); + b.addActionListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + Object item = use.getSelectedItem(); + if (item.equals("Formula")) { + try { + writeToFile("CMD show " + folder.getText().toUpperCase()); + rawCmd("<" + cmdFile + ">"); + s2.setVisible(true); + } catch (IOException e1) { + // TODO + } + } else if (item.equals("File")) { + try { + writeToFile("CMD use.a " + folder.getText()); + rawCmd("<" + cmdFile + ">"); + } catch (IOException e1) { + // TODO + } + } + } + }); p.add(b); p.add(new JSeparator()); txt = new JTextPane(); txt.setText("Save"); p.add(txt); - + box = Box.createHorizontalBox(); JTextField save = new JTextField(); save.add(new JLabel("folder")); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ One dashboard for servers and applications across Physical-Virtual-Cloud Widest out-of-the-box monitoring support with 50+ applications Performance metrics, stats and reports that give you Actionable Insights Deep dive visibility with transaction tracing using APM Insight. http://ad.doubleclick.net/ddm/clk/290420510;117567292;y _______________________________________________ Jmol-commits mailing list Jmol-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/jmol-commits