01: package net.sourceforge.squirrel_sql.client.gui.db.aliasproperties;
02:
03: import net.sourceforge.squirrel_sql.client.gui.BaseInternalFrame;
04: import net.sourceforge.squirrel_sql.fw.gui.GUIUtils;
05: import net.sourceforge.squirrel_sql.fw.util.StringManager;
06: import net.sourceforge.squirrel_sql.fw.util.StringManagerFactory;
07:
08: import javax.swing.*;
09: import java.awt.*;
10: import java.util.prefs.Preferences;
11:
12: public class AliasPropertiesInternalFrame extends BaseInternalFrame {
13: private static final String PREF_KEY_ALIAS_PROPS_SHEET_WIDTH = "Squirrel.aliasPropsSheetWidth";
14: private static final String PREF_KEY_ALIAS_PROPS_SHEET_HEIGHT = "Squirrel.aliasPropsSheetHeight";
15:
16: private static final StringManager s_stringMgr = StringManagerFactory
17: .getStringManager(AliasPropertiesInternalFrame.class);
18:
19: JTabbedPane tabPane;
20: JButton btnOk;
21: JButton btnClose;
22:
23: AliasPropertiesInternalFrame(String title) {
24: setDefaultCloseOperation(DISPOSE_ON_CLOSE);
25: GUIUtils.makeToolWindow(this , true);
26: setSize(getDimension());
27: setResizable(true);
28:
29: getContentPane().setLayout(new GridBagLayout());
30:
31: GridBagConstraints gbc;
32: gbc = new GridBagConstraints(0, 0, 1, 1, 0, 0,
33: GridBagConstraints.NORTHWEST, GridBagConstraints.NONE,
34: new Insets(5, 5, 5, 5), 0, 0);
35: // i18n[AliasPropertiesInternalFrame.title=Properties for Alias: {0}]
36: getContentPane().add(
37: new JLabel(s_stringMgr.getString(
38: "AliasPropertiesInternalFrame.title", title)),
39: gbc);
40:
41: tabPane = new JTabbedPane();
42: gbc = new GridBagConstraints(0, 1, 1, 1, 1, 1,
43: GridBagConstraints.NORTHWEST, GridBagConstraints.BOTH,
44: new Insets(5, 5, 5, 5), 0, 0);
45: getContentPane().add(tabPane, gbc);
46:
47: JPanel pnlButtons = new JPanel();
48: gbc = new GridBagConstraints(0, 2, 1, 1, 0, 0,
49: GridBagConstraints.NORTH, GridBagConstraints.NONE,
50: new Insets(0, 5, 5, 5), 0, 0);
51: getContentPane().add(pnlButtons, gbc);
52:
53: // i18n[AliasPropertiesInternalFrame.ok=OK]
54: btnOk = new JButton(s_stringMgr
55: .getString("AliasPropertiesInternalFrame.ok"));
56: pnlButtons.add(btnOk);
57:
58: // i18n[AliasPropertiesInternalFrame.close=Close]
59: btnClose = new JButton(s_stringMgr
60: .getString("AliasPropertiesInternalFrame.close"));
61: pnlButtons.add(btnClose);
62: }
63:
64: private Dimension getDimension() {
65: return new Dimension(Preferences.userRoot().getInt(
66: PREF_KEY_ALIAS_PROPS_SHEET_WIDTH, 600), Preferences
67: .userRoot().getInt(PREF_KEY_ALIAS_PROPS_SHEET_HEIGHT,
68: 600));
69: }
70:
71: public void dispose() {
72: Dimension size = getSize();
73: Preferences.userRoot().putInt(PREF_KEY_ALIAS_PROPS_SHEET_WIDTH,
74: size.width);
75: Preferences.userRoot().putInt(
76: PREF_KEY_ALIAS_PROPS_SHEET_HEIGHT, size.height);
77:
78: super.dispose();
79: }
80:
81: }
|