pText.setBackground(SystemColor.control);
pLabel.setBackground(SystemColor.control);
pButton.setBackground(SystemColor.control);
pLabel.add(createLabel("Recent:"));
recent = new Choice();
try {
settings = ConnectionDialogCommon.loadRecentConnectionSettings();
} catch (java.io.IOException ioe) {
ioe.printStackTrace();
}
recent.add(ConnectionDialogCommon.emptySettingName);
Enumeration en = settings.elements();
while (en.hasMoreElements()) {
recent.add(((ConnectionSetting) en.nextElement()).getName());
}
recent.addItemListener(new ItemListener() {
public void itemStateChanged(ItemEvent e) {
String s = (String) e.getItem();
ConnectionSetting setting =
(ConnectionSetting) settings.get(s);
if (setting != null) {
mName.setText(setting.getName());
mDriver.setText(setting.getDriver());
mURL.setText(setting.getUrl());
mUser.setText(setting.getUser());
mPassword.setText(setting.getPassword());
}
}
});
pText.add(recent);
Button b;
b = new Button("Clr");
b.setActionCommand("Clear");
b.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
ConnectionDialogCommon.deleteRecentConnectionSettings();
settings = new Hashtable();
recent.removeAll();
recent.add(ConnectionDialogCommon.emptySettingName);
mName.setText(null);
}
});
pClearButton.add(b);
pLabel.add(createLabel("Setting Name:"));
mName = new TextField("");
pText.add(mName);
pLabel.add(createLabel("Type:"));
types = new Choice();
connTypes = ConnectionDialogCommon.getTypes();
for (int i = 0; i < connTypes.length; i++) {
types.add(connTypes[i][0]);
}