[Advanced-java] Re: Readonly JTextField

Florian Roth rothflorian at gmx.de
Tue Apr 15 09:42:50 2003


HI

I'd create a new class extending JRadioButton or JCheckBox and overwrite the
setEnabled() method like this:

//For JRadioButton
String key = "radioButton.foreground";

//For JCeckBox
String key = "checkBox.foreground";

public void setEnabled(boolean b){
   super.setEnabled(b);

   //Set foreground color as if not disabled
   setForeground(UIManager.getColor(key));
}