List of usage examples for javax.swing.text MaskFormatter setOverwriteMode
public void setOverwriteMode(boolean overwriteMode)
From source file:Main.java
MaskFormatter createFormatter(String format) { MaskFormatter formatter = null; try {//from w w w. j a va2s . c o m formatter = new MaskFormatter(format); formatter.setPlaceholderCharacter('.'/*or '0' etc*/); formatter.setAllowsInvalid(false); // if needed formatter.setOverwriteMode(true); // if needed } catch (java.text.ParseException exc) { System.err.println("formatter is bad: " + exc.getMessage()); } return formatter; }