howto use JFormattedTextField allowing only letters and numbers

Posted by Erik on Stack Overflow See other posts from Stack Overflow or by Erik
Published on 2011-11-20T17:41:55Z Indexed on 2011/11/20 17:52 UTC
Read the original article Hit count: 450

I have this code and cannot get MaskFormatter right
maskformatter

MaskFormatter formatter = null;
  try {
    formatter = new MaskFormatter("HHHHHHH");
  } catch (ParseException e) {
    e.printStackTrace();
  }

txtTroll = new JFormattedTextField(formatter);

I need Any hex character (0-9, a-f or A-F) and the "H" should
give me only (0-9, a-f or A-F) but im getting it wrong.

When i type text only capital letters are typed and it's slow to
and when i click away from the txtTroll all letters vanish

© Stack Overflow or respective owner

Related posts about java

Related posts about input-validation