MaskFormatter mf = null; try { mf = new MaskFormatter("UUU-UU-####"); } catch (ParseException pe) { } kennzeichen = new JFormattedTextField(mf);