How to set SWT button foreground color?

On Windows, setForeground for Buttons has no effects.

As a workaround, add a PaintListener to your Button. On this Listener’s paintControl method, get the generated event’s GC and, with it, re-write the text of your Button using the color you want.

You can, in fact, draw anything over your Button.

Leave a Comment