• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

JTextField validation / Document Listener

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Good Morning,
I am validating a JTextField on a GUI via a ConstraintException on a set method in a value bean. I am using a DocumentListener on the JTextField to call the set method. When I hit a constraint I want to reset the JTextField to the value in the value bean. I am receiving the error java.lang.IllegalStateException: Attempt to mutate in notification.
try {
gui.getTextField().getDocument().insertString(0, valueBean.getValue(), null);
} catch (BadLocationException e) {}
From what I have read the text field can't deal with a change event while reacting to a user's change, but this seems like the most logical place.
Any thoughts/ideas would be greatly appreciated.
Pam
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic