在java语言中,如何在FormattedTextField中仅添加介于0和255之间的数字?
我试过这样做:
private JFormattedTextField text4;
//...
text4= new JFormattedTextField(paymentFormat);
text4.getValue();
text4.setColumns(3);
try {
MaskFormatter mask = new MaskFormatter("###");
mask.install(text4);
} catch (ParseException ex) {
System.out.print("Valoarea nu e corecta");
}它不起作用..。
发布于 2013-03-07 21:56:53
有两种方法
JFormattedTextField来设置整型DocumentFilter to JFormattedTextField,并确定整型、双精度值是否小于0且大于255https://stackoverflow.com/questions/15272921
复制相似问题