OSDN Git Service

置換文字設定を削除
[coroid/inqubus.git] / frontend / src / yukihane / inqubus / gui / NumberFormattedTextField.java
1 package yukihane.inqubus.gui;
2
3 import java.awt.event.FocusEvent;
4 import java.text.DecimalFormat;
5 import javax.swing.JFormattedTextField;
6 import javax.swing.JTextField;
7 import javax.swing.SwingUtilities;
8
9 /**
10  *
11  * @author yuki
12  */
13 public class NumberFormattedTextField extends JFormattedTextField {
14
15     private static final long serialVersionUID = 1L;
16
17     public NumberFormattedTextField() {
18         super(new DecimalFormat("#"));
19         this.setHorizontalAlignment(JTextField.RIGHT);
20         this.addFocusListener(new FocusAdapter());
21     }
22
23     public class FocusAdapter extends java.awt.event.FocusAdapter {
24
25         @Override
26         public void focusGained(FocusEvent e) {
27             SwingUtilities.invokeLater(new Runnable() {
28
29                 @Override
30                 public void run() {
31                     selectAll();
32                 }
33             });
34         }
35     }
36 }