Community
Participate
Working Groups
The following snippet attempts but fails to lock the CoolBar, because it does so early (right after the CoolBar is created). However if this line is moved down to just before the readAndDispatch loop then it works fine. public static void main (String [] args) { Display display = new Display (); Shell shell = new Shell (display); CoolBar bar = new CoolBar (shell, SWT.BORDER); bar.setLocked(true); // does not work here for (int i=0; i<2; i++) { CoolItem item = new CoolItem (bar, SWT.NONE); } bar.setSize (200, 600); shell.open (); Button button = new Button (bar, SWT.PUSH); button.setText ("FRED"); button.pack (); Point size = button.getSize (); CoolItem [] items = bar.getItems (); CoolItem item = items [0]; item.setControl (button); item.setSize (item.computeSize (size.x, size.y)); // if bar.setLocked(true); here then ok while (!shell.isDisposed()) { if (!display.readAndDispatch ()) display.sleep (); } display.dispose (); }
I didn't, but very likely this is a dup of 14330. *** This bug has been marked as a duplicate of 14330 ***