How to set SWT button foreground color?

Solution 1:

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.

Solution 2:

If you need Button with style SWT.CHECK you can try use Button without text and add Label element. Example:

chkAutorun = new Button(fCompositeLogin, SWT.CHECK);
Label lblAutorun = new Label(fCompositeLogin, SWT.NONE);
lblAutorun.setForeground(white);
lblAutorun.setText("Autorun");