1 package hayashi.yuu.tools.properties;
\r
3 import java.awt.event.ActionEvent;
\r
4 import java.awt.event.FocusEvent;
\r
5 import java.awt.event.FocusListener;
\r
6 import javax.swing.JTextField;
\r
8 @SuppressWarnings("serial")
\r
9 public class PropertyFieldItem extends PropertyItem implements FocusListener
\r
11 public PropertyFieldItem(hayashi.yuu.tools.properties.Properties prop, String name, String title, boolean editable) {
\r
12 super(prop, name, title);
\r
13 field = new JTextField(value, 20);
\r
14 ((JTextField)field).addFocusListener(this);
\r
15 createItem(name, title, prop.getProperty(name), editable);
\r
19 void setupField(String name, String value, boolean editable) {
\r
21 ((JTextField)field).setText(value);
\r
23 field.setEnabled(editable);
\r
29 public void actionPerformed(ActionEvent e) {
\r
30 this.value = ((JTextField)this.field).getText();
\r
31 logger.info("[反映] "+ propertyName +" = "+ this.value);
\r
32 prop.setProperty(propertyName, this.value);
\r
36 * このフィールドにカーソルが移ったときの処理
\r
38 public void focusGained(FocusEvent arg0) {
\r
43 * このフィールドから他のフィールドへカーソルが移った時の処理。
\r
45 public void focusLost(FocusEvent arg0) {
\r
46 actionPerformed(null);
\r