how to define an eclipse mask formatted text field?
问题 I need to put a masked formatted text field in my jframe, i put it like this MaskFormatter mask = new MaskFormatter("########/##"); JFormattedTextField txtName = new JFormattedTextField(mask); but when I run the program the textField is empty and it doesn't save it on data base 回答1: From MaskFormatter documentation we can see that # Any valid number, uses Character.isDigit . If you want to accept text (letters and digits) use A Any character or number ( Character.isLetter or Character.isDigit