This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Java Interview Guide and have Anthony DePalma on-line!
See this thread for details.
The moose likes IDEs, Version Control and other tools and the fly likes DocumentListener and Netbeans Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » IDEs, Version Control and other tools
Bookmark "DocumentListener and Netbeans" Watch "DocumentListener and Netbeans" New topic

DocumentListener and Netbeans

Sam Bluesman
Ranch Hand

Joined: Nov 21, 2004
Posts: 191

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?


Moosey knows best
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
Michael Kato

Joined: Aug 06, 2010
Posts: 12
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.
I agree. Here's the link:
subject: DocumentListener and Netbeans
It's not a secret anymore!