> apparently, this is a known bug
>
> http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4783068
yes, did you read also about workaround there?
I suggest however to use a slightly another solution:
public class HtmlButton2 extends JButton {
private String html = "<html>";
private String disabledColor = "<font color=\"gray\">";
String enabledText;
String disabledText;
boolean isHtml;
public HtmlButton2() {
super();
}
public HtmlButton2(String text) {
super(text);
}
public void setText(String text) {
if (text.startsWith(html)) {
isHtml = true;
enabledText = text;
text = text.substring(html.length());
disabledText = html + disabledColor + text;
if (isEnabled()) {
setTextImpl(enabledText);
}
else {
setTextImpl(disabledText);
}
}
else {
isHtml = false;
enabledText = text;
disabledText = text;
setTextImpl(enabledText);
}
}
protected void setTextImpl(String text) {
super.setText(text);
}
public void setEnabled(boolean b) {
if (isHtml) {
if (b) {
setTextImpl(enabledText);
}
else {
setTextImpl(disabledText);
}
}
super.setEnabled(b);
}
}

Signature
Andrey Kuznetsov
http://uio.imagero.com Unified I/O for Java
http://reader.imagero.com Java image reader
http://jgui.imagero.com Java GUI components and utilities
anikkar@gmail.com - 27 Oct 2005 23:40 GMT
thanks...i'll give it a try
anikkar@gmail.com - 31 Oct 2005 22:58 GMT
Hi Andrey,
I tried this, and I got a problem at first, and found that you needed
to set the html and disabled fields as static, and then everything
works out. Thanks!