我想限制no。可以放在JTextField
上的字符,因为在我的数据库中,我有这个列有Sex,Status(允许的字符数只有1)。java应用。字符串操作
和中间初始值(其中允许的字符数仅为2)。
这是我在我的脑海:
(性别,状态栏)
String text = jTextField2.getText();
int count = text.();
if (count>1) {
(delete the next character that will be input)
}
(用于M.I.列)
String text = jTextField1.getText();
int count = text.();
if (count>2) {
(delete the next character that will be input)
}
这可能吗?有没有一个命令会删除下一个字符,所以没有。的字符。我的数据库可以接受吗?
对不起,我把“==”而不是“>”,我的坏。 – 2013-04-10 02:57:46