001: /*
002: * Created on Aug 19, 2004
003: *
004: * TODO To change the template for this generated file go to
005: * Window - Preferences - Java - Code Style - Code Templates
006: */
007: package com.pk.preferences;
008:
009: import java.awt.GridBagConstraints;
010: import java.awt.GridBagLayout;
011: import java.awt.Insets;
012: import java.awt.event.ActionListener;
013:
014: import javax.swing.JButton;
015:
016: import javax.swing.JComboBox;
017: import javax.swing.JLabel;
018: import javax.swing.JPanel;
019:
020: import javax.swing.JTextField;
021:
022: /**
023: * @author Chris Taylor
024: *
025: */
026: public class PropertiesPanel extends JPanel {
027:
028: /**
029: *
030: */
031: private static final long serialVersionUID = 286423509225605764L;
032: private JButton newButton;
033: private JButton removeButton;
034: private ActionListener actionListener = null;
035: private JTextField txtName = null;
036: private JTextField txtURL = null;
037: private JTextField txtDriver = null;
038: private JComboBox txtDialect = null;
039:
040: /**
041: * @return Returns the txtDialect.
042: */
043: public JComboBox getTxtDialect() {
044: return txtDialect;
045: }
046:
047: /**
048: * @return Returns the txtDriver.
049: */
050: public JTextField getTxtDriver() {
051: return txtDriver;
052: }
053:
054: /**
055: * @return Returns the txtName.
056: */
057: public JTextField getTxtName() {
058: return txtName;
059: }
060:
061: /**
062: * @return Returns the txtURL.
063: */
064: public JTextField getTxtURL() {
065: return txtURL;
066: }
067:
068: /**
069: *
070: */
071: public PropertiesPanel(ActionListener argActionListener) {
072: super ();
073: actionListener = argActionListener;
074: JLabel label = new JLabel();
075: this .setLayout(new GridBagLayout());
076: GridBagConstraints gbc = new GridBagConstraints();
077: gbc.anchor = GridBagConstraints.WEST;
078: gbc.insets = new Insets(6, 15, 6, 15);
079:
080: gbc.gridx = 0;
081: gbc.gridy = 0;
082: label = new JLabel("Name:", JLabel.LEFT);
083: this .add(label, gbc);
084:
085: gbc.gridy++;
086: label = new JLabel("URL:", JLabel.LEFT);
087: this .add(label, gbc);
088:
089: gbc.gridy++;
090: label = new JLabel("Driver:", JLabel.LEFT);
091: this .add(label, gbc);
092:
093: gbc.gridy++;
094: label = new JLabel("Dialect:", JLabel.LEFT);
095: this .add(label, gbc);
096:
097: gbc.gridx = 1;
098: gbc.gridy = 0;
099:
100: txtName = new JTextField(25);
101: this .add(txtName, gbc);
102:
103: gbc.gridy++;
104: txtURL = new JTextField(25);
105: this .add(txtURL, gbc);
106:
107: gbc.gridy++;
108: txtDriver = new JTextField(25);
109: this .add(txtDriver, gbc);
110:
111: gbc.gridy++;
112: String dialects[] = { "com.pk.OracleDialect",
113: "com.pk.MySQLDialect", "com.pk.DefaultDialect",
114: "com.pk.MicrosoftSQLDialect" };
115: txtDialect = new JComboBox(dialects);
116: txtDialect.setEditable(true);
117: txtDialect.setSelectedIndex(-1);
118: this .add(txtDialect, gbc);
119:
120: gbc.gridx = 0;
121: gbc.gridy = 4;
122: gbc.gridwidth = GridBagConstraints.REMAINDER;
123: gbc.anchor = GridBagConstraints.CENTER;
124: JPanel buttonPanel = new JPanel();
125: newButton = new JButton("New Connection Config");
126: newButton.addActionListener(actionListener);
127: removeButton = new JButton("Remove");
128: removeButton.addActionListener(actionListener);
129: buttonPanel.add(newButton);
130: buttonPanel.add(removeButton);
131: this .add(buttonPanel, gbc);
132: }
133:
134: /**
135: * @return Returns the actionListener.
136: */
137: public ActionListener getActionListener() {
138: return actionListener;
139: }
140:
141: /**
142: * @param actionListener The actionListener to set.
143: */
144: public void setActionListener(ActionListener actionListener) {
145: this .actionListener = actionListener;
146: }
147:
148: /**
149: * @return Returns the okButton.
150: */
151: /**
152: * @return Returns the newButton.
153: */
154: public JButton getNewButton() {
155: return newButton;
156: }
157:
158: /**
159: * @return Returns the removeButton.
160: */
161: public JButton getRemoveButton() {
162: return removeButton;
163: }
164: /**
165: * @return Returns the closeButton.
166: */
167: }
|