further work on reorganizing things

This commit is contained in:
benfry
2003-11-08 21:01:53 +00:00
parent 1cf2ddcb7c
commit f7723f5685
8 changed files with 570 additions and 487 deletions

View File

@@ -93,7 +93,7 @@ public class PdePreferences extends JComponent {
JCheckBox newSketchPromptBox;
JTextField sketchbookLocationField;
JCheckbox externalEditorBox;
JCheckBox externalEditorBox;
// data model
@@ -177,8 +177,8 @@ public class PdePreferences extends JComponent {
// setup frame for the prefs
//frame = new JFrame("Preferences");
frame = new JDialog("Preferences");
frame = new JFrame("Preferences");
//frame = new JDialog("Preferences");
frame.setResizable(false);
Container pain = this;
@@ -315,7 +315,7 @@ public class PdePreferences extends JComponent {
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
apply();
hideFrame();
disposeFrame();
}
});
pain.add(button);
@@ -327,7 +327,7 @@ public class PdePreferences extends JComponent {
button = new JButton(PROMPT_CANCEL);
button.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
hideFrame();
disposeFrame();
}
});
pain.add(button);
@@ -353,11 +353,13 @@ public class PdePreferences extends JComponent {
//
/*
frame.addWindowListener(new WindowAdapter() {
public void windowClosing(WindowEvent e) {
frame.hide();
}
});
*/
}
@@ -369,8 +371,9 @@ public class PdePreferences extends JComponent {
}
public void hideFrame() {
frame.hide();
public void disposeFrame() {
frame.hide()
//frame.dispose();
}
@@ -547,6 +550,12 @@ public class PdePreferences extends JComponent {
defaultValue : value;
}
static public void set(String attribute, String value) {
preferences.put(attribute, value);
}
static public boolean getBoolean(String attribute /*, boolean defaultValue*/) {
String value = get(attribute, null);
return (value == null) ? defaultValue :
@@ -566,6 +575,12 @@ public class PdePreferences extends JComponent {
*/
}
static public boolean setBoolean(String attribute, boolean value) {
set(attribute, value ? "true" : "false");
}
static public int getInteger(String attribute /*, int defaultValue*/) {
String value = get(attribute, null);
if (value == null) return defaultValue;
@@ -583,6 +598,11 @@ public class PdePreferences extends JComponent {
}
static public void setInteger(String key, int value) {
set(key, String.valueOf(value));
}
static public Color getColor(String name /*, Color otherwise*/) {
Color parsed = null;
String s = get(name, null);