01: /*
02: * Copyright (C) 2005 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.dbcopy.gui;
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: import net.sourceforge.squirrel_sql.plugins.dbcopy.prefs.DBCopyPreferenceBean;
32: import net.sourceforge.squirrel_sql.plugins.dbcopy.prefs.PreferencesManager;
33:
34: public class TestPreferencesPanel {
35:
36: /**
37: * @param args
38: */
39: public static void main(String[] args) throws Exception {
40: JFrame f = new JFrame();
41: f.getContentPane().setLayout(new BorderLayout());
42: ApplicationArguments.initialize(new String[0]);
43: PreferencesManager.initialize(new DummyPlugin());
44: DBCopyPreferenceBean bean = PreferencesManager.getPreferences();
45: final PreferencesPanel p = new PreferencesPanel(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: PreferencesManager.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: }
|