[Polycasso-commit] SF.net SVN: polycasso:[105] trunk/polycasso/src/com/mebigfatguy/polycasso/ Setti
Brought to you by:
dbrosius
|
From: <dbr...@us...> - 2009-11-29 02:20:12
|
Revision: 105
http://polycasso.svn.sourceforge.net/polycasso/?rev=105&view=rev
Author: dbrosius
Date: 2009-11-29 02:19:59 +0000 (Sun, 29 Nov 2009)
Log Message:
-----------
select all on focus
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 02:11:06 UTC (rev 104)
+++ trunk/polycasso/src/com/mebigfatguy/polycasso/SettingsDialog.java 2009-11-29 02:19:59 UTC (rev 105)
@@ -23,6 +23,8 @@
import java.awt.Dimension;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
+import java.awt.event.FocusEvent;
+import java.awt.event.FocusListener;
import javax.swing.BorderFactory;
import javax.swing.Box;
@@ -32,6 +34,7 @@
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextField;
+import javax.swing.text.JTextComponent;
import com.jgoodies.forms.layout.CellConstraints;
import com.jgoodies.forms.layout.FormLayout;
@@ -75,6 +78,8 @@
}
private JPanel createOptionsPanel() {
+
+ SelectAllFocuser focuser = new SelectAllFocuser();
JPanel optPanel = new JPanel();
optPanel.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10));
optPanel.setLayout(new FormLayout("pref, 3dlu, 100px, 5dlu, pref, 3dlu, 100px", "pref, 1dlu, pref, 15dlu, pref, 1dlu, pref"));
@@ -90,6 +95,7 @@
widthLabel.setLabelFor(widthField);
widthField.setText(String.valueOf(dlgSettings.getMaxImageSize().width));
optPanel.add(widthField, cc.xy(3, 3));
+ widthField.addFocusListener(focuser);
JLabel heightLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.Height));
optPanel.add(heightLabel, cc.xy(5, 3));
@@ -98,6 +104,7 @@
heightLabel.setLabelFor(heightField);
heightField.setText(String.valueOf(dlgSettings.getMaxImageSize().height));
optPanel.add(heightField, cc.xy(7, 3));
+ heightField.addFocusListener(focuser);
JLabel maxPolyLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaximumPolygons));
optPanel.add(maxPolyLabel, cc.xyw(1, 5, 5));
@@ -106,6 +113,7 @@
maxPolyLabel.setLabelFor(maxPolygonField);
maxPolygonField.setText(String.valueOf(dlgSettings.getMaxPolygons()));
optPanel.add(maxPolygonField, cc.xy(7, 5));
+ maxPolygonField.addFocusListener(focuser);
JLabel maxPtMoveLabel = new JLabel(PolycassoBundle.getString(PolycassoBundle.Key.MaximumPointMovement));
optPanel.add(maxPtMoveLabel, cc.xyw(1, 7, 5));
@@ -114,6 +122,7 @@
maxPtMoveLabel.setLabelFor(maxPtMoveField);
maxPtMoveField.setText(String.valueOf(dlgSettings.getMaxPtMovement()));
optPanel.add(maxPtMoveField, cc.xy(7, 7));
+ maxPtMoveField.addFocusListener(focuser);
return optPanel;
}
@@ -154,5 +163,17 @@
});
}
+ private static class SelectAllFocuser implements FocusListener {
+ @Override
+ public void focusGained(FocusEvent fe) {
+ JTextComponent comp = (JTextComponent)fe.getSource();
+ comp.selectAll();
+ }
+
+ @Override
+ public void focusLost(FocusEvent fe) {
+ }
+
+ }
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|