Buttons and colors
Maurizio DE CECCO
maurizio at mandrakesoft.com
Wed Feb 16 10:13:14 PST 2000
I am trying to develop an application that allow user customization
of component colors.
OK, the original AWT *is* limited in this, and in order to, for
example, change the Button color in highlighted and pushed state you
need to do some terrible acks with the mouse listener; but it *is*
possible.
Trying the same code with kaffe (that is the target JVM for the
application) i discovered that it simply do not work.
A closer look to the kaffe Button source code show that the text and
background colors for the highlighed and the pushed state are
hardcoded, either directly in the Button code, or in the Defaults
class.
I am willing to fix this problem and provide a patch, but i would like
to be sure that:
1- actually the Kaffe people think it is a problem and are willing to include
the patch in their distribution.
2- they agree with the technique i'll use.
The goal of the patch is to be able to use the MouseEntered method of
a mouse listener connected to the button to change the background of
the button *while* it is highlighted, so to be able to customize the
background behaviour in the highlight (and push) state.
What i intend to do is to store the 'current' background and
foreground button colors in the object state, and change them when the
button state change; then, if the paint honor the current colors, and
not derive them from the state, the mouse listener can have an
opportunity to change the colors before the next paint.
This is apparently what happens on the Sun AWT; i don't think this is part
of the button specification anyway :-> ...
What do you people think ?
Maurizio
--
Maurizio De Cecco
MandrakeSoft http://www.mandrakesoft.com/
More information about the kaffe
mailing list