--- /dev/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.JTextField;\r
+\r
+@SuppressWarnings("serial")\r
+public class PropertyFieldItem extends PropertyItem implements FocusListener\r
+{\r
+ public PropertyFieldItem(hayashi.yuu.tools.properties.Properties prop, String name, String title, boolean editable) {\r
+ super(prop, name, title);\r
+ field = new JTextField(value, 20);\r
+ ((JTextField)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
+ ((JTextField)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
+ this.value = ((JTextField)this.field).getText();\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