Help JButton

B

Bao

Hi all

how do you disable a JButton? I try

JButton a = new JButton("A");

a.disable();

doesn't work.

Thanks in advance.
 
W

wobegon

Bao said:
Hi all

how do you disable a JButton? I try

JButton a = new JButton("A");

a.disable();

doesn't work.

Thanks in advance.

See javadoc for JComponent::setEnabled(boolean enabled). Also, your JButton
might have an Action provided for it -- disabling the action will have the
same effect.

HTH!
Sean.
 
K

Kevin Pors

Hi all

how do you disable a JButton? I try

JButton a = new JButton("A");

a.disable();

doesn't work.

Thanks in advance.

Have you tried

a.setEnabled(false);

?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,012
Latest member
RoxanneDzm

Latest Threads

Top