1 | public class TestPreferencesPanel {↵ | | 1 | public class TestSQLScriptPreferencesPanel {↵
|
|
2 | /**↵ | | 2 | /**↵
|
3 | * @param args↵ | | 3 | * @param args↵
|
4 | */↵ | | 4 | */↵
|
5 | public static void main(String[] args) throws Exception {↵ | | 5 | public static void main(String[] args) throws Exception {↵
|
6 | JFrame f = new JFrame();↵ | | 6 | JFrame f = new JFrame();↵
|
7 | f.getContentPane().setLayout(new BorderLayout());↵ | | 7 | f.getContentPane().setLayout(new BorderLayout());↵
|
8 | ApplicationArguments.initialize(new String[0]);↵ | | 8 | ApplicationArguments.initialize(new String[0]);↵
|
9 | PreferencesManager.initialize(new DummyPlugin());↵ | | 9 | SQLScriptPreferencesManager.initialize(new DummyPlugin());↵
|
10 | DBCopyPreferenceBean bean = PreferencesManager.getPreferences();↵ | | 10 | SQLScriptPreferenceBean bean = SQLScriptPreferencesManager.getPreferences();↵
|
11 | final PreferencesPanel p = new PreferencesPanel(bean);↵ | | 11 | final SQLScriptPreferencesPanel p = new SQLScriptPreferencesPanel(bean);↵
|
12 | JScrollPane sp = new JScrollPane(p);↵ | | 12 | JScrollPane sp = new JScrollPane(p);↵
|
13 | f.getContentPane().add(sp, BorderLayout.CENTER);↵ | | 13 | f.getContentPane().add(sp, BorderLayout.CENTER);↵
|
14 | JButton button = new JButton("Save");↵ | | 14 | JButton button = new JButton("Save");↵
|
15 | button.addActionListener(new ActionListener() {↵ | | 15 | button.addActionListener(new ActionListener() {↵
|
16 | public void actionPerformed(ActionEvent e) {↵ | | 16 | public void actionPerformed(ActionEvent e) {↵
|
17 | p.applyChanges();↵ | | 17 | p.applyChanges();↵
|
18 | PreferencesManager.unload();↵ | | 18 | SQLScriptPreferencesManager.unload();↵
|
19 | }↵ | | 19 | }↵
|
20 | });↵ | | 20 | });↵
|
21 | JButton exitButton = new JButton("Exit");↵ | | 21 | JButton exitButton = new JButton("Exit");↵
|
22 | exitButton.addActionListener(new ActionListener() {↵ | | 22 | exitButton.addActionListener(new ActionListener() {↵
|
23 | public void actionPerformed(ActionEvent e) {↵ | | 23 | public void actionPerformed(ActionEvent e) {↵
|
24 | System.exit(0);↵ | | 24 | System.exit(0);↵
|
25 | }↵ | | 25 | }↵
|
26 | });↵ | | 26 | });↵
|
27 | JPanel buttonPanel = new JPanel();↵ | | 27 | JPanel buttonPanel = new JPanel();↵
|
28 | buttonPanel.add(button);↵ | | 28 | buttonPanel.add(button);↵
|
29 | buttonPanel.add(exitButton);↵ | | 29 | buttonPanel.add(exitButton);↵
|
30 | f.getContentPane().add(buttonPanel, BorderLayout.SOUTH);↵ | | 30 | f.getContentPane().add(buttonPanel, BorderLayout.SOUTH);↵
|
31 | f.setBounds(200, 50,700, 700);↵ | | 31 | f.setBounds(200, 50,700, 700);↵
|
32 | f.setVisible(true) | | 32 | f.setVisible(true)
|