[Advanced-java] Readonly property for JCheckBox and JRadioButton
Nikolaos Giannopoulos
nikolaos at solmar.ca
Mon Apr 14 20:04:32 2003
> -----Original Message-----
> From: advanced-java-bounces@lists.xcf.berkeley.edu
> [mailto:advanced-java-bounces@lists.xcf.berkeley.edu]On Behalf Of
> I do not want to use the enabled property
> because the component label/text becomes
> darkgray.
>
> Do you know a way to create a readonly
> JCheckBox or JRadioButton, or does anyone
> know how to change the textcolor and bullet-
> color of a disabled component to black.
I would imagine this can be done if you muck around with the UI classes but
I'm not sure.
You could however - as a work around - create a composite component i.e. a
JPanel with a JLabel and a JCheckBox/JRadioButton which would allow you to
separately control the label from the widget part.
You could subclass JCheckBox/JRadioBox so that your component can be used
just like a JCheckBox/JRadioBox and re-write their public methods to
delegate to your composite components.
--Nikolaos