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.JPasswordField;
\r
8 @SuppressWarnings("serial")
\r
9 public class PropertyPasswordItem extends PropertyItem implements FocusListener
\r
11 public PropertyPasswordItem(hayashi.yuu.tools.properties.Properties prop, String name, String title, boolean editable) {
\r
12 super(prop, name, title);
\r
13 field = new JPasswordField(value, 20);
\r
14 ((JPasswordField)field).addFocusListener(this);
\r
15 createItem(name, title, prop.getProperty(name), editable);
\r
19 void setupField(String name, String value, boolean editable) {
\r
21 ((JPasswordField)field).setText(value);
\r
23 field.setEnabled(editable);
\r
29 public void actionPerformed(ActionEvent e) {
\r
30 char[] chars = ((JPasswordField)this.field).getPassword();
\r
31 this.value = new String(chars);
\r
32 logger.info("[反映] "+ propertyName +" = "+ this.value);
\r
33 prop.setProperty(propertyName, this.value);
\r
37 * このフィールドにカーソルが移ったときの処理
\r
39 public void focusGained(FocusEvent arg0) {
\r
44 * このフィールドから他のフィールドへカーソルが移った時の処理。
\r
46 public void focusLost(FocusEvent arg0) {
\r
47 actionPerformed(null);
\r