/** * Adds the given Bean to the collection of Beans with preferences editors. When the dialog box is * opened, the editor associated with the Bean will be included in the GUI. */ public void addPrefsBean(BeanPreferences bean) { mPrefsBeans.add(bean); mTabbedViewPane.add(new JScrollPane(bean.getEditor()), bean.getEditorName()); bean.initPrefsGUI(); mTabbedViewPane.revalidate(); DefaultListModel model = (DefaultListModel) mListViewBeans.getModel(); model.addElement(bean.getEditorName()); }
/** Commits changes on all known Bean preference editors. */ private void commit() { java.util.Iterator i = mPrefsBeans.iterator(); while (i.hasNext()) { BeanPreferences bean = (BeanPreferences) i.next(); try { bean.save(); } catch (java.io.IOException io_ex) { JOptionPane.showMessageDialog( null, "Could not save preferences for " + bean.getEditorName() + ": " + io_ex.getMessage(), "I/O Exception on Save", JOptionPane.ERROR_MESSAGE); } } }
private void prefsBeanListValueChanged(ListSelectionEvent e) { BeanPreferences bean = (BeanPreferences) mPrefsBeans.elementAt(e.getFirstIndex()); mListViewEditorPane.getViewport().add(bean.getEditor()); mListViewEditorPane.revalidate(); }