由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - JTextField 只允许小于N的input 怎么实现的?
相关主题
新手求教JTextField的问题Re: print problem, GUI guru please come in
Is this a Bug or not?Eclipse的Javadoc信息显示问题
GUI THANKSextending generic class , but not mentioning its parameterized type?
Re: Error handling in Jelly, SwixML andHow to redirect standard input in java
Ask a questionhow to change the input mode?
how to hide and show the cursor in JTextField?One simple question!
请教一个MessageListener的问题问几个菜问题
jtextfield上的listener被触发之前的值怎么读?问几个菜问题2
相关话题的讨论汇总
话题: jtextfield话题: input话题: 小于话题: 实现
进入Java版参与讨论
1 (共1页)
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全部拷到不可以的那边,还是不行。。
: 。。

1 (共1页)
进入Java版参与讨论
相关主题
问几个菜问题2Ask a question
ask a question about Chow to hide and show the cursor in JTextField?
expression in unicode请教一个MessageListener的问题
Please recommend a book for learning javajtextfield上的listener被触发之前的值怎么读?
新手求教JTextField的问题Re: print problem, GUI guru please come in
Is this a Bug or not?Eclipse的Javadoc信息显示问题
GUI THANKSextending generic class , but not mentioning its parameterized type?
Re: Error handling in Jelly, SwixML andHow to redirect standard input in java
相关话题的讨论汇总
话题: jtextfield话题: input话题: 小于话题: 实现