Make sure that you do not mix the colors of SWT and AWT, and if you create a Color object, make sure you destroy it. You want something like:
final Color myColor = new Color(getDisplay(), 102, 255, 102); myLabel.setForeground(color); myLabel.addDisposeListener(new DisposeListener() { public void widgetDisposed(DisposeEvent e) { myColor.dispose(); } });
Or you can just use the system's built-in colors:
myLabel.setForeground(getDisplay().getSystemColor(SWT.COLOR_GREEN));
(Do not use system colors.)
Edward thomson
source share