1 33 package com.nqadmin.swingSet.formatting; 34 35 import javax.swing.text.MaskFormatter ; 36 import java.io.Serializable ; 37 import java.text.ParseException ; 38 39 40 41 public class SSBaseFormatterFactory extends javax.swing.text.DefaultFormatterFactory implements Serializable { 42 43 44 public SSBaseFormatterFactory() { 45 this("##-########-#"); 46 } 47 48 public SSBaseFormatterFactory(String mask) { 49 50 try { 51 this.setDefaultFormatter(new MaskFormatter (mask)); 52 this.setNullFormatter(null); 53 this.setEditFormatter(new MaskFormatter (mask)); 54 this.setDisplayFormatter(new MaskFormatter (mask)); 55 } 56 catch (java.text.ParseException pe) { 57 pe.printStackTrace(); 58 } 59 } 60 61 62 } 63 64 65 80 | Popular Tags |