my dog learned polymorphism
The moose likes Swing / AWT / SWT and the fly likes re-enable buttons Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "re-enable buttons" Watch "re-enable buttons" New topic

re-enable buttons

Walter Rust

Joined: Aug 12, 2002
Posts: 1
I have a program with four buttons. One of the buttons clears the text from a textfield AND disables the other three buttons. What I would like to be able to do is be able to click into the textfield and have this action (the clicking into) re-enable the other three buttons. If need be, I'll post the class

Wal Rus
Eli Daum

Joined: Jul 29, 2002
Posts: 12
just call a method that checks a boolean condition that you would want to satisfy and then call button.setEnabled(true);
also add a mouse clicked event for the text area and setEnabled(true); when someone fires the event (by clicking inside the text area)
[ August 12, 2002: Message edited by: Eli Daum ]
Thomas Suer
Ranch Hand

Joined: Sep 03, 2001
Posts: 50
You also could add a FocusListener to your textarea and handle the enabling mechanism of the desired buttons when the textarea gets the focus. This would have the advantage that enabling the buttons also would take place if the user navigates to the textarea via the keyboard...
Good luck
I agree. Here's the link:
subject: re-enable buttons
jQuery in Action, 3rd edition