views:

20

answers:

2

I need an off/on indicator for a panel in my Swing application.

My gut reaction is to try to use a JCheckbox, and somehow disable the mouse input and change the checkbox state only through my program. But a radio button would look better.

Is this the best way to do so (& if so, how to disable mouse input w/o making the control look disabled), or is there a better indicator element?

+1  A: 

Yep, why not. Just use setEnabled() method (JPanel inherits it, so don't worry).

Xorty
How can I do this but change the text from gray to its regular color?
Jason S
setEnabled(true)
Xorty
A: 

Use check box but change the icon to look like following round button ( which is a check box BTW ) alt text

eugener