001: /*
002: JSmooth: a VM wrapper toolkit for Windows
003: Copyright (C) 2003 Rodrigo Reyes <reyes@charabia.net>
004:
005: This program is free software; you can redistribute it and/or modify
006: it under the terms of the GNU General Public License as published by
007: the Free Software Foundation; either version 2 of the License, or
008: (at your option) any later version.
009:
010: This program is distributed in the hope that it will be useful,
011: but WITHOUT ANY WARRANTY; without even the implied warranty of
012: MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
013: GNU General Public License for more details.
014:
015: You should have received a copy of the GNU General Public License
016: along with this program; if not, write to the Free Software
017: Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
018:
019: */
020:
021: package net.charabia.jsmoothgen.application.gui.util;
022:
023: import net.charabia.jsmoothgen.application.*;
024: import net.charabia.jsmoothgen.application.gui.*;
025: import java.util.*;
026: import com.l2fprod.common.swing.*;
027: import javax.swing.*;
028: import java.awt.*;
029:
030: /**
031: *
032: * @author Rodrigo
033: */
034: public class PropertyEditorDialog extends BaseDialog {
035: private JavaPropertyPair m_prop;
036: private JTextField m_key = new JTextField();
037: private JTextField m_value = new JTextField();
038:
039: public PropertyEditorDialog(JavaPropertyPair prop) {
040: super ();
041: setTitle(Main.local("JAVAPROP_DIALOG_TITLE"));
042: setModal(true);
043: m_prop = prop;
044: getContentPane().setLayout(new PanelLayout());
045:
046: JLabel eq = new JLabel(" = ");
047: eq.setHorizontalAlignment(JLabel.CENTER);
048:
049: OptionalHelpPanel keypane = new OptionalHelpPanel();
050: keypane.setLabel(Main.local("JAVAPROP_DIALOG_LABEL"));
051: keypane.setHelpText(Main.local("JAVAPROP_DIALOG_HELP"));
052: keypane.getContentPane().setLayout(new GridBagLayout());
053:
054: GridBagConstraints c = new GridBagConstraints();
055: c.fill = GridBagConstraints.HORIZONTAL;
056: c.gridx = GridBagConstraints.RELATIVE;
057: c.gridy = GridBagConstraints.RELATIVE;
058: c.gridwidth = 1; // GridBagConstraints.RELATIVE;
059:
060: c.weightx = 0.5;
061: keypane.getContentPane().add(
062: new JLabel(Main.local("JAVAPROP_NAME")), c);
063: c.weightx = 0.1;
064: keypane.getContentPane().add(new JLabel(""), c);
065: c.weightx = 0.5;
066: c.gridwidth = GridBagConstraints.REMAINDER;
067: keypane.getContentPane().add(
068: new JLabel(Main.local("JAVAPROP_VALUE")), c);
069:
070: c.gridwidth = 1; // GridBagConstraints.RELATIVE;
071: c.weightx = 0.5;
072: keypane.getContentPane().add(m_key, c);
073:
074: c.weightx = 0.1;
075: keypane.getContentPane().add(eq, c);
076:
077: c.weightx = 0.5;
078: keypane.getContentPane().add(m_value, c);
079:
080: getContentPane().add(keypane);
081:
082: getBanner().setVisible(false);
083: setResizable(false);
084: pack();
085:
086: m_key.setText(m_prop.getName());
087: m_value.setText(m_prop.getValue());
088: }
089:
090: public Dimension getMinimumSize() {
091: return new Dimension(400, 250);
092: }
093:
094: public Dimension getPreferredSize() {
095: return new Dimension(400, 250);
096: }
097:
098: public void ok() {
099: m_prop.setName(m_key.getText());
100: m_prop.setValue(m_value.getText());
101: super.ok();
102: }
103:
104: }
|