getContentPane().setLayout(new BorderLayout());
getContentPane().add(upper, BorderLayout.CENTER);
getContentPane().add(lower, BorderLayout.SOUTH);
final CardLayout cardLayout = new CardLayout();
main.setLayout(cardLayout);
// ----------------------------------------------------------------
// Add tabs to tabbed here. Remember, tabs must implement PrefsTab.
// ----------------------------------------------------------------
ArrayList<PrefsTab> tabs = new ArrayList<PrefsTab>();
tabs.add(new GeneralTab(frame, prefs));
tabs.add(new FileTab(frame, prefs));
tabs.add(new EntryEditorPrefsTab(frame, prefs));
tabs.add(new GroupsPrefsTab(prefs));
tabs.add(new AppearancePrefsTab(prefs));
tabs.add(new ExternalTab(frame, this, prefs, parent.helpDiag));
tabs.add(new TablePrefsTab(prefs, parent));
tabs.add(new TableColumnsTab(prefs, parent));
tabs.add(new TabLabelPattern(prefs, parent.helpDiag));
tabs.add(new PreviewPrefsTab(prefs));
tabs.add(new NameFormatterTab(parent.helpDiag));
tabs.add(new XmpPrefsTab());
tabs.add(new AdvancedTab(prefs, parent.helpDiag));
Iterator<PrefsTab> it = tabs.iterator();
String[] names = new String[tabs.size()];
int i = 0;
//ArrayList<Component> comps = new ArrayList<Component>();
while (it.hasNext()) {
PrefsTab tab = it.next();
names[i++] = tab.getTabName();
main.add((Component) tab, tab.getTabName());
}
upper.setBorder(BorderFactory.createEtchedBorder());
chooser = new JList(names);
chooser.setBorder(BorderFactory.createEtchedBorder());
// Set a prototype value to control the width of the list:
chooser.setPrototypeCellValue("This should be wide enough");
chooser.setSelectedIndex(0);
chooser.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
// Add the selection listener that will show the correct panel when
// selection changes:
chooser.addListSelectionListener(new ListSelectionListener() {
public void valueChanged(ListSelectionEvent e) {
if (e.getValueIsAdjusting())
return;
String o = (String) chooser.getSelectedValue();
cardLayout.show(main, o);
}
});
JPanel one = new JPanel(), two = new JPanel();
one.setLayout(new BorderLayout());