Project: SWT
Bug 120980 Regression: Image on disabled button no longer greyed out
Reported: 2005-12-14 19:50:23 | Status: resolved fixed

SWT-win32 v3218, Windows XP, Classic Theme, Manifest Run the testcase below. Even though the button is disabled, the icon is unchanged from its "enabled" look, giving no indication that you cannot press the button. In 3.1-final, the icon was greyed out. Not a problem when using the Luna Theme or running without the manifest file. --- import org.eclipse.swt.*; import org.eclipse.swt.graphics.*; import org.eclipse.swt.layout.*; import org.eclipse.swt.widgets.*; public class ButtonImageTest { public static void main(String[] args) { Display display = new Display(); Shell shell = new Shell(display); shell.setLayout(new GridLayout()); Image icon = new Image(display, 16, 16); GC gc = new GC(icon); gc.setBackground(display.getSystemColor(SWT.COLOR_BLACK)); gc.drawRectangle(0, 0, 15, 15); gc.fillRectangle(4, 4, 8, 8); gc.dispose(); Button btn = new Button(shell, SWT.PUSH); btn.setImage(icon); btn.setEnabled(false); shell.pack(); shell.open(); while (!shell.isDisposed()) { if (!display.readAndDispatch()) display.sleep(); } icon.dispose(); display.dispose(); } }

Files changed in fix:
bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Button.java