-package hayashi.yuu.tools.properties;
-
-import java.awt.event.ActionEvent;
-import java.awt.event.FocusEvent;
-import java.awt.event.FocusListener;
-import javax.swing.JPasswordField;
-
-@SuppressWarnings("serial")
-public class PropertyPasswordItem extends PropertyItem implements FocusListener
-{
- public PropertyPasswordItem(hayashi.yuu.tools.properties.Properties prop, String name, String title, boolean editable) {
- super(prop, name, title, editable);
- field = new JPasswordField(value, 20);
- ((JPasswordField)field).addFocusListener(this);
- createItem(name, title, prop.getProperty(name), editable);
- }
-
- @Override
- void setupField(String name, String value, boolean editable) {
- this.value = value;
- ((JPasswordField)field).setText(value);
- if (!editable) {
- field.setEnabled(editable);
- }
- add(field);
- }
-
- @Override
- public void actionPerformed(ActionEvent e) {
- char[] chars = ((JPasswordField)this.field).getPassword();
- this.value = new String(chars);
- logger.info("[反映] "+ propertyName +" = "+ this.value);
- prop.setProperty(propertyName, this.value);
- }
-
- /**
- * このフィールドにカーソルが移ったときの処理
- */
- public void focusGained(FocusEvent arg0) {
- // 何もしない
- }
-
- /**
- * このフィールドから他のフィールドへカーソルが移った時の処理。
- */
- public void focusLost(FocusEvent arg0) {
- actionPerformed(null);
- }
-}
+package hayashi.yuu.tools.properties;\r
+\r
+import java.awt.event.ActionEvent;\r
+import java.awt.event.FocusEvent;\r
+import java.awt.event.FocusListener;\r
+import javax.swing.JPasswordField;\r
+\r
+@SuppressWarnings("serial")\r
+public class PropertyPasswordItem extends PropertyItem implements FocusListener\r
+{\r
+ public PropertyPasswordItem(hayashi.yuu.tools.properties.Properties prop, String name, String title, boolean editable) {\r
+ super(prop, name, title, editable);\r
+ field = new JPasswordField(value, 20);\r
+ ((JPasswordField)field).addFocusListener(this);\r
+ createItem(name, title, prop.getProperty(name), editable);\r
+ }\r
+\r
+ @Override\r
+ void setupField(String name, String value, boolean editable) {\r
+ this.value = value;\r
+ ((JPasswordField)field).setText(value);\r
+ if (!editable) {\r
+ field.setEnabled(editable);\r
+ }\r
+ add(field);\r
+ }\r
+ \r
+ @Override\r
+ public void actionPerformed(ActionEvent e) {\r
+ char[] chars = ((JPasswordField)this.field).getPassword();\r
+ this.value = new String(chars);\r
+ logger.info("[反映] "+ propertyName +" = "+ this.value);\r
+ prop.setProperty(propertyName, this.value);\r
+ }\r
+\r
+ /**\r
+ * このフィールドにカーソルが移ったときの処理\r
+ */\r
+ public void focusGained(FocusEvent arg0) {\r
+ // 何もしない\r
+ }\r
+\r
+ /**\r
+ * このフィールドから他のフィールドへカーソルが移った時の処理。\r
+ */\r
+ public void focusLost(FocusEvent arg0) {\r
+ actionPerformed(null);\r
+ }\r
+}\r