I'm trying to right a statement that depends on 2 JButtons not being enabled
I know how to tell if they are enabled
like this

if(myJButton.isEnabled())
{
}

But is their also a simple way to check if a JButton is not Enabled

Recommended Answers

All 5 Replies

simple way to check if a JButton is not Enabled

isEnabled() would return false if the button is not enabled and true if otherwise
Isn't that enough to know that the button is not enabled?

commented: why go easy if you can go the hard way ... thought this post would solve the thread, but hey :) +12

Look at using the NOT (!) operator.

Look at using the NOT (!) operator.

umm, i Tried many cobinantions,

and they all give errors, do you mean like? if (J1.is!=Enabled ())

no

if ( !J1.isEnabled())
commented: if(!thank() you) :P +6

no

if ( !J1.isEnabled())

thank you very much

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.