Greying out buttons in swing

Status
Not open for further replies.

phreak0ut

The Thread Killer >:)
How to grey out buttons after it is clicked in Swing? Like, when we click Apply, it's greyed out in most applications.
 

QwertyManiac

Commander in Chief
At the end of the operation performed, call buttonObject.setEnabled(false);

The question seems too trivial to ask, maybe you're looking for an automatic solution? In case of that, I do not know and I hope someone with proper Swing experience would come along and answer that.

P.s. Is there, by any chance or anything similar to, a formObject.isDirty() call? You could use that in a validator function that keeps listening.
 
OP
phreak0ut

phreak0ut

The Thread Killer >:)
I'm still pretty new to Swing and don't have much idea as to what are the methods available. I'll try the one you suggested QM. It's like clicking on Apply after you chose your screensaver in Windows and the button greys out.
 
OP
phreak0ut

phreak0ut

The Thread Killer >:)
@QM your suggestion worked. Now, it's time to apply action listener to enable once the text boxes are filled and another button is clicked.
 
Status
Not open for further replies.
Top Bottom