Topic: 请问一个单行且只能输入数字的JList组件应该如何写?

  Print this page

1.请问一个单行且只能输入数字的JList组件应该如何写? Copy to clipboard
Posted by: jfml
Posted on: 2003-04-22 16:16

就像Windows的时间设置里设置年份的那个一样
每次只能显示单行
可以在其中进行数字编辑

请问该如何写呢

谢谢达人指点

2.Re:请问一个单行且只能输入数字的JList组件应该如何写? [Re: CrazyJavar] Copy to clipboard
Posted by: jiangns3000
Posted on: 2003-04-22 20:24

定制 javax.swing.JSpinner的模型即可。

3.Re:请问一个单行且只能输入数字的JList组件应该如何写? [Re: CrazyJavar] Copy to clipboard
Posted by: jfml
Posted on: 2003-04-23 09:55

那是在1.4上的

我的程序一定要跑在1.3.1上阿

郁闷

4.Re:请问一个单行且只能输入数字的JList组件应该如何写? [Re: CrazyJavar] Copy to clipboard
Posted by: jfml
Posted on: 2003-04-23 09:57

哪位有在1.3.1上写的类似JSpinner的组件阿

谢谢了

5.Re:请问一个单行且只能输入数字的JList组件应该如何写? [Re: CrazyJavar] Copy to clipboard
Posted by: jfml
Posted on: 2003-04-23 17:03

up

6.Re:请问一个单行且只能输入数字的JList组件应该如何写? [Re: CrazyJavar] Copy to clipboard
Posted by: jackycct
Posted on: 2003-04-25 01:09

No spinner in 1.3.1....
May be you can write a JTextField and accept only numeric chars.
Try the method below :

Document lvDoc = lvTextField.getDocument();
lvDoc.addDocumentListener(lvListener);

in lvListener, you need to override these functions
void   changedUpdate(DocumentEvent e)
Gives notification that an attribute or set of attributes changed.
void   insertUpdate(DocumentEvent e)
Gives notification that there was an insert into the document.
void   removeUpdate(DocumentEvent e)
Gives notification that a portion of the document has been removed.

whenever there is digit in the document, remove them

7.Re:请问一个单行且只能输入数字的JList组件应该如何写? [Re: CrazyJavar] Copy to clipboard
Posted by: Julian13
Posted on: 2003-04-25 09:07

can i copy the JFormatterTextfield from 1.4 and use it in 1.3?
these will save lots of work creating the new wheel. Wink

8.Re:请问一个单行且只能输入数字的JList组件应该如何写? [Re: CrazyJavar] Copy to clipboard
Posted by: yakuu
Posted on: 2003-04-25 12:09

Here is a XSpinButton.
It's a widget from my yakuucore open source package.
please keep the author information in it.
any bug report is welcomed!

thx, and wish it can help you.

XSpinButton.java (23.42k)

9.Re:请问一个单行且只能输入数字的JList组件应该如何写? [Re: CrazyJavar] Copy to clipboard
Posted by: jfml
Posted on: 2003-04-25 16:27

谢谢楼上的哥们

已经采用了你的东东

写得不错

只是有个小问题

这个组件只支持ChangeListener,不支持ActionListener等其它Listener

10.Re:请问一个单行且只能输入数字的JList组件应该如何写? [Re: CrazyJavar] Copy to clipboard
Posted by: yakuu
Posted on: 2003-04-25 17:03

you can modify it freely.

please send me a copy if you have any good suggestion.


   Powered by Jute Powerful Forum® Version Jute 1.5.6 Ent
Copyright © 2002-2021 Cjsdn Team. All Righits Reserved. 闽ICP备05005120号-1
客服电话 18559299278    客服信箱 714923@qq.com    客服QQ 714923