J**B 发帖数: 204 | 1 ssnField.setColumns(4);
这个input field只能呢键入小于4个数字,上面的这行好像不管用。 |
u****s 发帖数: 2186 | 2 use JFormattedTextField() with a MaskFormatter("####") |
J**B 发帖数: 204 | 3 很奇怪,我的程序里另一个页面就JTextField 可以实现,两边的流程几乎一模一样。
【在 u****s 的大作中提到】 : use JFormattedTextField() with a MaskFormatter("####")
|
e*****t 发帖数: 1005 | 4 你确定那个object是JFormattedTextField?
JFormattedTextField extends JTextField.
【在 J**B 的大作中提到】 : 很奇怪,我的程序里另一个页面就JTextField 可以实现,两边的流程几乎一模一样。
|
J**B 发帖数: 204 | 5 确定,两个flow 都是用的JTextField,一边改变setcolumns()的parameter就可以改
变maxim input 一边就是不管用。 查了好几天了,这个BUG。 现在用 ssnField.
setDocument(Document doc). 做了个新的class extends Document.
【在 e*****t 的大作中提到】 : 你确定那个object是JFormattedTextField? : JFormattedTextField extends JTextField.
|
g*****g 发帖数: 34805 | 6 setColumns应该可以吧?需要更近一步就是做个KeyListener,然后
在实现里validate输入。
【在 J**B 的大作中提到】 : ssnField.setColumns(4); : 这个input field只能呢键入小于4个数字,上面的这行好像不管用。
|
J**B 发帖数: 204 | 7 妖就妖在,我把可以的那边的整个panel的code全部拷到不可以的那边,还是不行。。
。。
【在 g*****g 的大作中提到】 : setColumns应该可以吧?需要更近一步就是做个KeyListener,然后 : 在实现里validate输入。
|
g*****g 发帖数: 34805 | 8 It might be revised inadvertently. Print getColumns before you
get text and see what you get.
【在 J**B 的大作中提到】 : 妖就妖在,我把可以的那边的整个panel的code全部拷到不可以的那边,还是不行。。 : 。。
|