Results 1 to 3 of 3
  1. #1
    r00tb33r is offline Member
    Join Date
    May 2010
    Posts
    14
    Rep Power
    0

    Default How to create UPPERCASE formatted text field with mixed character input

    I am looking for a way to instantly format text that user types to uppercase. However the input will contain non-alphabet characters such as spaces and dashes. I tried JFormattedTextField with a long "UUUUUUUUUUUUUUUU" mask, but it is not able to handle non-alphabet characters.
    For example format "bp96-00826a" into "BP96-00826A".
    Is there a better or an easier way to do this than a document listener?
    Document listener seems a bit of an overkill to do something so conceptually simple.
    Thanks in advance.

  2. #2
    r00tb33r is offline Member
    Join Date
    May 2010
    Posts
    14
    Rep Power
    0

    Default

    Actually nevermind, I couldn't figure out how to do it using DocumentListener.
    I would get "Exception in thread "AWT-EventQueue-0" java.lang.IllegalStateException: Attempt to mutate in notification" every time I try to make the text uppercase inside the listener while the user is typing.
    So I do need help, an example to be exact.
    Thanks in advance!

  3. #3
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

Similar Threads

  1. count character in text file as input file
    By aNNuur in forum New To Java
    Replies: 7
    Last Post: 03-25-2010, 04:01 PM
  2. Problem in reading HTML input field while uploading file
    By sudipanand in forum Java Servlet
    Replies: 1
    Last Post: 11-27-2008, 09:26 AM
  3. Regarding Text Field
    By adeeb in forum AWT / Swing
    Replies: 1
    Last Post: 06-05-2008, 11:01 PM
  4. reading text character by character
    By bugger in forum New To Java
    Replies: 2
    Last Post: 11-09-2007, 08:54 PM
  5. Create entity field SEQUENCE oracle
    By Marcus in forum JDBC
    Replies: 1
    Last Post: 06-27-2007, 03:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •