Project: SWT
Bug 205099 Creating a button clears mnemonics
Reported: 2007-10-01 14:04:05 | Status: resolved fixed

public static void main (String [] args) { Display display = new Display (); final Shell shell = new Shell (display); shell.setLayout (new RowLayout ()); Table table = new Table (shell, SWT.NONE); for (int i=0; i<8; i++) { TableItem item = new TableItem (table, SWT.NONE); item.setText (i + " Item " + i + " that is really wide!"); } Tree tree = new Tree (shell, SWT.NONE); for (int i=0; i<8; i++) { TreeItem item = new TreeItem (tree, SWT.NONE); item.setText (i + " Item " + i + " that is really wide!"); } Canvas canvas = new Canvas (shell, SWT.BORDER); Listener listener = new Listener () { public void handleEvent (Event e) { GC gc = e.gc; gc.drawRectangle(10, 10, 20, 20); gc.drawFocus(12, 12, 17, 17); } }; canvas.addListener (SWT.Paint, listener); Button button = new Button (shell, SWT.PUSH); button.setText ("&Create a Control"); button.addListener (SWT.Selection, new Listener () { public void handleEvent (Event e) { new Button (shell, SWT.NONE).dispose (); //CLEARS FOCUS DRAWING } }); shell.pack (); shell.open (); while (!shell.isDisposed ()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); }

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