01: /*
02: * Copyright (C) 2006 Rob Manning
03: * manningr@users.sourceforge.net
04: *
05: * This library is free software; you can redistribute it and/or
06: * modify it under the terms of the GNU Lesser General Public
07: * License as published by the Free Software Foundation; either
08: * version 2.1 of the License, or (at your option) any later version.
09: *
10: * This library is distributed in the hope that it will be useful,
11: * but WITHOUT ANY WARRANTY; without even the implied warranty of
12: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13: * Lesser General Public License for more details.
14: *
15: * You should have received a copy of the GNU Lesser General Public
16: * License along with this library; if not, write to the Free Software
17: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
18: */
19: package net.sourceforge.squirrel_sql.plugins.sqlscript.prefs;
20:
21: import java.awt.BorderLayout;
22: import java.awt.event.ActionEvent;
23: import java.awt.event.ActionListener;
24:
25: import javax.swing.JButton;
26: import javax.swing.JFrame;
27: import javax.swing.JPanel;
28: import javax.swing.JScrollPane;
29:
30: import net.sourceforge.squirrel_sql.client.ApplicationArguments;
31:
32: public class TestSQLScriptPreferencesPanel {
33:
34: /**
35: * @param args
36: */
37: public static void main(String[] args) throws Exception {
38: JFrame f = new JFrame();
39: f.getContentPane().setLayout(new BorderLayout());
40: ApplicationArguments.initialize(new String[0]);
41: SQLScriptPreferencesManager.initialize(new DummyPlugin());
42: SQLScriptPreferenceBean bean = SQLScriptPreferencesManager
43: .getPreferences();
44: final SQLScriptPreferencesPanel p = new SQLScriptPreferencesPanel(
45: bean);
46: JScrollPane sp = new JScrollPane(p);
47: f.getContentPane().add(sp, BorderLayout.CENTER);
48: JButton button = new JButton("Save");
49: button.addActionListener(new ActionListener() {
50: public void actionPerformed(ActionEvent e) {
51: p.applyChanges();
52: SQLScriptPreferencesManager.unload();
53: }
54: });
55: JButton exitButton = new JButton("Exit");
56: exitButton.addActionListener(new ActionListener() {
57: public void actionPerformed(ActionEvent e) {
58: System.exit(0);
59: }
60: });
61: JPanel buttonPanel = new JPanel();
62: buttonPanel.add(button);
63: buttonPanel.add(exitButton);
64: f.getContentPane().add(buttonPanel, BorderLayout.SOUTH);
65: f.setBounds(200, 50, 700, 700);
66: f.setVisible(true);
67: }
68:
69: }
|