summaryrefslogtreecommitdiff
path: root/sources/client/inputforms/Preferences.java
diff options
context:
space:
mode:
authorPaul Buetow <paul@buetow.org>2009-02-18 23:01:21 +0000
committerPaul Buetow <paul@buetow.org>2009-02-18 23:01:21 +0000
commit89c679eb813611a2ede208b4c8e27c7f596b3be7 (patch)
treef44c19435286e78b9e8002990e1b55183a4fbc49 /sources/client/inputforms/Preferences.java
parent177f346a9bbe455dc12fd26dfa2c586585c28c1e (diff)
added copyright to header
Diffstat (limited to 'sources/client/inputforms/Preferences.java')
-rw-r--r--sources/client/inputforms/Preferences.java158
1 files changed, 81 insertions, 77 deletions
diff --git a/sources/client/inputforms/Preferences.java b/sources/client/inputforms/Preferences.java
index a08fa65..02ebfd6 100644
--- a/sources/client/inputforms/Preferences.java
+++ b/sources/client/inputforms/Preferences.java
@@ -1,3 +1,7 @@
+/* NetCalendar 2006, 2009 (c) Dipl.-Inform. (FH) Paul C. Buetow
+ * http://netcalendar.buetow.org - netcalendar@dev.buetow.org
+ */
+
package client.inputforms;
import java.awt.event.*;
@@ -17,83 +21,83 @@ import shared.*;
*
*/
public class Preferences extends InputForm {
- private final static long serialVersionUID = 1L;
-
- private String[] labels = null;
- private int iNumPairs = -1;
-
- /**
- * Create the input form window and show it.
- * @param netCalendarClient Specifies the current calendar client session window.
- */
- public Preferences(NetCalendarClient netCalendarClient) {
- super("Preferences", netCalendarClient);
- initComponents();
- setFieldValues();
- pack();
- setVisible(true);
- }
-
- /**
- * Initializes all the GUI components.
- */
- protected void initComponents() {
- super.initComponents();
- setFieldValues();
- JPanel jPanel = new JPanel(new SpringLayout());
-
- labels = Config.getSortedKeyArray();
- iNumPairs = labels.length;
-
- ActionListener actionListenerTextFields = new ActionListener() {
- public void actionPerformed(ActionEvent event) {
- submit();
- }
- };
-
- vecFields = new Vector();
- for (int i = 0; i < iNumPairs; ++i) {
- JLabel jLable = new JLabel(labels[i], JLabel.TRAILING);
- jPanel.add(jLable);
- JTextField textField = new JTextField(InputForm.TEXTFIELD_LENGTH);
- textField.addActionListener(actionListenerTextFields);
- jLable.setLabelFor(textField);
- jPanel.add(textField);
- vecFields.add(textField);
+ private final static long serialVersionUID = 1L;
+
+ private String[] labels = null;
+ private int iNumPairs = -1;
+
+ /**
+ * Create the input form window and show it.
+ * @param netCalendarClient Specifies the current calendar client session window.
+ */
+ public Preferences(NetCalendarClient netCalendarClient) {
+ super("Preferences", netCalendarClient);
+ initComponents();
+ setFieldValues();
+ pack();
+ setVisible(true);
+ }
+
+ /**
+ * Initializes all the GUI components.
+ */
+ protected void initComponents() {
+ super.initComponents();
+ setFieldValues();
+ JPanel jPanel = new JPanel(new SpringLayout());
+
+ labels = Config.getSortedKeyArray();
+ iNumPairs = labels.length;
+
+ ActionListener actionListenerTextFields = new ActionListener() {
+ public void actionPerformed(ActionEvent event) {
+ submit();
+ }
+ };
+
+ vecFields = new Vector();
+ for (int i = 0; i < iNumPairs; ++i) {
+ JLabel jLable = new JLabel(labels[i], JLabel.TRAILING);
+ jPanel.add(jLable);
+ JTextField textField = new JTextField(InputForm.TEXTFIELD_LENGTH);
+ textField.addActionListener(actionListenerTextFields);
+ jLable.setLabelFor(textField);
+ jPanel.add(textField);
+ vecFields.add(textField);
+ }
+
+ //Lay out the panel.
+ GUIHelper.makeCompactGrid(jPanel,
+ iNumPairs, 2, // iRows, iCols
+ 6, 6, // iInitX, iInitY
+ 6, 6); // iXPad, iYPad
+
+ jPanelButtons.remove(jButtonClear);
+ JSplitPane jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
+ jSplitPane.setTopComponent(jPanel);
+ jSplitPane.setBottomComponent(jPanelButtons);
+ jSplitPane.setDividerSize(0);
+
+ setContentPane(jSplitPane);
}
- //Lay out the panel.
- GUIHelper.makeCompactGrid(jPanel,
- iNumPairs, 2, // iRows, iCols
- 6, 6, // iInitX, iInitY
- 6, 6); // iXPad, iYPad
-
- jPanelButtons.remove(jButtonClear);
- JSplitPane jSplitPane = new JSplitPane(JSplitPane.VERTICAL_SPLIT);
- jSplitPane.setTopComponent(jPanel);
- jSplitPane.setBottomComponent(jPanelButtons);
- jSplitPane.setDividerSize(0);
-
- setContentPane(jSplitPane);
- }
-
- /**
- * This method sets the fields of the edit frame according to the current configuration options.
- */
- private void setFieldValues() {
- for (int i = 0; i < iNumPairs; ++i)
- ((JTextField) vecFields.get(i)).setText(Config.getStringValue(labels[i]));
- }
-
- /**
- * This method is invoked if the enter key is pressed or if the submit button
- * has been pressed. It starts a client request relating to the user's input of
- * the text fields. It will write all changes to the netcalendar.conf file.
- */
- protected void submit() {
- for (int i = 0; i < iNumPairs; ++i)
- Config.setValue(labels[i], ((JTextField) vecFields.get(i)).getText());
-
- Config.writeConfigToFile();
- }
+ /**
+ * This method sets the fields of the edit frame according to the current configuration options.
+ */
+ private void setFieldValues() {
+ for (int i = 0; i < iNumPairs; ++i)
+ ((JTextField) vecFields.get(i)).setText(Config.getStringValue(labels[i]));
+ }
+
+ /**
+ * This method is invoked if the enter key is pressed or if the submit button
+ * has been pressed. It starts a client request relating to the user's input of
+ * the text fields. It will write all changes to the netcalendar.conf file.
+ */
+ protected void submit() {
+ for (int i = 0; i < iNumPairs; ++i)
+ Config.setValue(labels[i], ((JTextField) vecFields.get(i)).getText());
+
+ Config.writeConfigToFile();
+ }
}