Buttons and colors

Peter Mehlitz peter at transvirtual.com
Wed Feb 16 11:22:09 PST 2000

> 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.

There shouldn't hardcoded values in the widget classes anymore. However,
initializing via "Defaults" is (almost) the way to accomplish what you
are looking for. It contains simple static field inits to control all
sort of colors, fonts etc. It's also crucial in getting the right colors
in a restricted color space (PseudoColor visual), and therefore
shouldn't be bypassed. This is a constant matter of confusion - you
might override Defaults with your own version, it's the preferred way to
configure the AWT look.

If you want to change the coloring scheme reg. the button state (it
already has this fly-over "BtnPointClr" color), that currently has to be
done by listening the relevant events. But there already is work going
on to extract the rendering into a dedicated "theme" (aka look&feel)
class, which you can override if you have specific needs.

-- Peter

More information about the kaffe mailing list