01: package org.dbbrowser.ui;
02:
03: import java.util.Observer;
04: import javax.swing.JFrame;
05: import javax.swing.JTabbedPane;
06: import infrastructure.internationalization.InternationalizationManager;
07:
08: public class PreferencesWindow {
09: private static final String TITLE = InternationalizationManager
10: .getInstance().getMessage("dbbrowser-ui",
11: "dbbrowser-ui-dbbrowser-window-title-label", null);
12: private static final String PREFERENCES_TAB_LABEL = InternationalizationManager
13: .getInstance()
14: .getMessage(
15: "dbbrowser-ui",
16: "dbbrowser-ui-preferences-window-preferences-panel-title",
17: null);
18: private static final String KEY_BINDINGS_TAB_LABEL = InternationalizationManager
19: .getInstance()
20: .getMessage(
21: "dbbrowser-ui",
22: "dbbrowser-ui-preferences-window-edit-key-bindings-panel-title",
23: null);
24:
25: private JFrame preferencesFrame = null;
26:
27: private JTabbedPane tabbedPane = new JTabbedPane();
28: private Observer observerForChangesInPreferences = null;
29:
30: public PreferencesWindow(Observer observer) {
31: this .observerForChangesInPreferences = observer;
32: this .preferencesFrame = new JFrame(TITLE);
33: this .preferencesFrame.setResizable(true);
34: this .preferencesFrame.setSize(600, 400);
35: this .preferencesFrame.setLocationRelativeTo(null);
36:
37: initialize();
38:
39: }
40:
41: public void show() {
42: preferencesFrame.setVisible(true);
43: }
44:
45: private void initialize() {
46: //Add the preferences panel
47: PreferencesPanel preferencesPanel = new PreferencesPanel();
48: this .tabbedPane.add(PREFERENCES_TAB_LABEL, preferencesPanel);
49:
50: //Add the key bindings panel
51: EditKeyBindingsPanel editKeyBindingsPanel = new EditKeyBindingsPanel(
52: this.observerForChangesInPreferences);
53: this.tabbedPane.add(KEY_BINDINGS_TAB_LABEL,
54: editKeyBindingsPanel);
55:
56: this.preferencesFrame.getContentPane().add(this.tabbedPane);
57: }
58: }
|