1 33 34 package com.nqadmin.swingSet.formatting; 35 36 import javax.swing.text.MaskFormatter ; 37 import java.util.Locale ; 38 39 import java.io.Serializable ; 40 import java.text.ParseException ; 41 42 46 public class SSNFormatterFactory extends javax.swing.text.DefaultFormatterFactory implements Serializable { 47 48 private MaskFormatter defaultFormatter; 49 private MaskFormatter displayFormatter; 50 private MaskFormatter editFormatter; 51 private MaskFormatter nullFormatter; 52 53 public SSNFormatterFactory() { 54 55 try { 56 defaultFormatter = new MaskFormatter ("###-##-####"); 57 nullFormatter = null; 58 editFormatter = new MaskFormatter ("###-##-####"); 59 displayFormatter = new MaskFormatter ("###-##-####"); 60 61 editFormatter.setPlaceholderCharacter('0'); 62 63 this.setDefaultFormatter(defaultFormatter); 64 this.setNullFormatter(nullFormatter); 65 this.setEditFormatter(editFormatter); 66 this.setDisplayFormatter(displayFormatter); 67 } 68 catch (java.text.ParseException pe) { 69 70 } 71 } 72 } 73 74 89 | Popular Tags |