textfiled.setDocument(new MyDocument());其中MyDocument是继承PlainDocument的子类。覆盖insertString和remove两个方法。详情请看:
http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html#validation
http://java.sun.com/docs/books/tutorial/uiswing/components/textfield.html#validation
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货