[Polycasso-commit] SF.net SVN: polycasso:[114] trunk/polycasso/src/com/mebigfatguy/polycasso/ Setti
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-11-29 03:05:54
|
Revision: 114
http://polycasso.svn.sourceforge.net/polycasso/?rev=114&view=rev
Author: dbrosius
Date: 2009-11-29 03:05:47 +0000 (Sun, 29 Nov 2009)
Log Message:
-----------
javadoc
Modified Paths:
--------------
trunk/polycasso/src/com/mebigfatguy/polycasso/SettingsDialog.java
Modified: trunk/polycasso/src/com/mebigfatguy/polycasso/SettingsDialog.java
===================================================================
--- trunk/polycasso/src/com/mebigfatguy/polycasso/SettingsDialog.java 2009-11-29 03:01:29 UTC (rev 113)
+++ trunk/polycasso/src/com/mebigfatguy/polycasso/SettingsDialog.java 2009-11-29 03:05:47 UTC (rev 114)
@@ -40,6 +40,10 @@
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
+/**
+ * a simple dialog to allow for the editing of various settings used to
+ * control how Polycasso works.
+ */
public class SettingsDialog extends JDialog {
private static final long serialVersionUID = 5044661806014080056L;
@@ -54,6 +58,11 @@
private JTextField maxPtMoveField;
private boolean isOK;
+ /**
+ * constructs the dialog using the passed in settings to set default values
+ *
+ * @param settings the default values for settings
+ */
public SettingsDialog(Settings settings) {
setTitle(PolycassoBundle.getString(PolycassoBundle.Key.Settings));
dlgSettings = (Settings)settings.clone();
@@ -62,14 +71,27 @@
isOK = false;
}
+ /**
+ * did the user click the ok button
+ *
+ * @return if the ok button was clicked
+ */
public boolean isOK() {
return isOK;
}
+ /**
+ * retrieves the settings set in the dialog by the user
+ *
+ * @return the updated settings
+ */
public Settings getSettings() {
return dlgSettings;
}
+ /**
+ * creates and layouts the components
+ */
private void initComponents() {
Container cp = getContentPane();
cp.setLayout(new BorderLayout(4, 4));
@@ -79,6 +101,11 @@
pack();
}
+ /**
+ * creates the options (settings) panel
+ *
+ * @returns the options panel
+ */
private JPanel createOptionsPanel() {
SelectAllFocuser focuser = new SelectAllFocuser();
@@ -137,6 +164,11 @@
return optPanel;
}
+ /**
+ * creates the control panel
+ *
+ * @return the control panel
+ */
private JPanel createControlPanel() {
JPanel ctrlPanel = new JPanel();
ctrlPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
@@ -153,6 +185,9 @@
return ctrlPanel;
}
+ /**
+ * sets up all the control listeners for the dialog
+ */
private void initListeners() {
okButton.addActionListener(new ActionListener() {
@Override
@@ -178,19 +213,37 @@
});
}
+ /**
+ * a class that selects the text component's text when focus is gained
+ */
private static class SelectAllFocuser implements FocusListener {
+ /**
+ * implements the listener to select all the text
+ *
+ * @param fe the focus event
+ */
@Override
public void focusGained(FocusEvent fe) {
JTextComponent comp = (JTextComponent)fe.getSource();
comp.selectAll();
}
+ /**
+ * unused
+ *
+ * @param fe the focus event
+ */
@Override
public void focusLost(FocusEvent fe) {
}
}
+ /**
+ * makes sure that settings selected are rational, and warns otherwise
+ *
+ * @return whether the settings are valid
+ */
private boolean validateSettings() {
if (dlgSettings.getMaxImageSize().width < 10) {
widthField.setText("10");
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|