Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

DocumentListener and Netbeans

 
Sam Bluesman
Ranch Hand
Posts: 191
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi.

I have created two jTextFields in a MainGUI class in netbeans. I have a button which starts disabled. It should only become enabled when the textfields have been updated, say length > 1.

I know I need to implement DocumentListeners to do this, but I'm not sure how I can go about doing this. I have looked at the tutorial on sun's website and the code provided but left me a little confused. I am unclear as to where the code should go seeing as I am using netbeans and much of the code defining the text fields has already been defined, nor do i know if it is possible to define through Netbeans' interface.

I was thinking maybe I have to create a textField ActionPerformed method and put the code in there, although I am unsure.

Can anyone help me?

Thanks
 
Michael Dunn
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
 
Michael Kato
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is old... sorry, but it came up in my google search.

I came across a similar situation. NetBeans' GUI builder does not seem to have any way to do this so you might have to add it with another editor manually if that's exactly what you need.

http://netbeans.org/bugzilla/show_bug.cgi?id=14364
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic