I use a custom painter that extends
DefaultHighlighter.DefaultHighlightPainter to highlight some text of a
JEditPane. The painter is created with a color that is the same as the
JEditPane's selection color.
On Windows, when using this painter, the highlight is drawn the correct color
but with Java 1.5 the text is not inverted as it should be. Under 1.4 the
same code works fine. The text in question is blue and is drawn using the
HTMLEditorKit when there is a hypertext link.
If I just use the mouse to select over this text, the text is highlighted in
the selection color and the text itself is drawn in white. However, using
the same selectiion color in my painter the text is left blue and is hard to
read against the slightly darker blue selection color.
Anyone have any idea what changed in 1.4 -> 1.5 to cause this? Know of a
fix?

Signature
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com
Bill Tschumy - 02 Nov 2004 18:21 GMT
> I use a custom painter that extends
> DefaultHighlighter.DefaultHighlightPainter to highlight some text of a
> JEditPane. The painter is created with a color that is the same as the
> JEditPane's selection color.
>
> On Windows, when using this painter, the highlight is drawn the correct color
> but with Java 1.5 the text is not inverted as it should be. Under 1.4 the
> same code works fine. The text in question is blue and is drawn using the
[quoted text clipped - 7 lines]
> Anyone have any idea what changed in 1.4 -> 1.5 to cause this? Know of a
> fix?
I think I've solved my own problem. Looks like the 1.5 code looks to see if
the painter is a DefaultHighlighter.DefaultHighlightPainter and does
something special to invert the text if it is. Being a subclass isn't good
enough. I was able to change my code to use the default
DefaultHighlighter.DefaultHighlightPainter and it is working again now.

Signature
Bill Tschumy
Otherwise -- Austin, TX
http://www.otherwise.com