Different behaviour of Jcomponet's setEnable() method is required

Hi all,

I want JcheckBoxes and JradioButtons in following way

1) which are not allowed to select or de-select

2) with labels in black colour

i used jComponent's setEnabled(false) method which only satisfy the first rule i have mensioned above. Labels are shown in grey colour.

Is there any other way to do this rather than extending jcheckBox and jRadioButton and override above method?

Thanks and regards!!!

[455 byte] By [ibmnewa] at [2007-10-3 6:08:42]
# 1
Hi dude,try like this,jRadioButton.setText("<html><font color=#000000>jRadioButton</font></html>");jRadioButton1.setEnabled(false);it will work fine for your problem...bye..
dhinakaran_apeca at 2007-7-15 0:51:49 > top of Java-index,Desktop,Core GUI APIs...
# 2
Hi dhinakaran,Thanks a lot for ur reply. But still I have a problem, the radion button's label is a variable which is set dynamically. In that case how can I set the radio button's text within html tags? Thanks a lot again,plz reply soon.
ibmnewa at 2007-7-15 0:51:49 > top of Java-index,Desktop,Core GUI APIs...
# 3
Hi dhinakaran,sorry. it's string so that i can edit and change as wanted. i tried and it worked perfectly. thanks a lot.Regards and bye...
ibmnewa at 2007-7-15 0:51:50 > top of Java-index,Desktop,Core GUI APIs...
# 4

It is the responsibility of the UI object to render the component, so ideally you should replace that with one you have overridden (see BasicButtonUI.painttext(), which is the method that paints greyed out text when disabled).

Are you sure that's what you want, though? If I saw a checkbox with black text I'd expect it to work and would get a bit annoyed if it didn't.

itchyscratchya at 2007-7-15 0:51:50 > top of Java-index,Desktop,Core GUI APIs...