private JPanel createComponent() { JPanel panel = PanelFactory.createDialogPanel("p, 4dlu, p", "p"); CellConstraints cc = new CellConstraints(); panel.add(combobox.getComponent(), cc.xy(1, 1)); panel.add( ButtonFactory.newCleanButton( ResourceUtility.getIcon("/uk/ac/ebi/chemet/render/images/cutout/browse_16x16.png"), new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { int choice = chooser.showOpenDialog(component); if (choice == JFileChooser.APPROVE_OPTION) { File file = chooser.getSelectedFile(); try { Reconstruction reconstruction = ReconstructionIOHelper.read(file); DefaultReconstructionManager.getInstance().addReconstruction(reconstruction); combobox.refresh(); combobox.setSelected(reconstruction); } catch (IOException ex) { ex.printStackTrace(); } catch (ClassNotFoundException ex) { ex.printStackTrace(); } } } }, "Open a reconstruction from disk"), cc.xy(3, 1)); return panel; }
public void refresh() { combobox.refresh(); }
public Reconstruction getSelected() { return combobox.getSelected(); }