Preventing the User from Rearranging the CoolBar
Executing the
CoolbarShellExample
program demonstrates how the
user can interact with the
CoolBar
. Each Button
can be
dragged and dropped into a new location on the
CoolBar
in any manner the user sees fit. The
Button
objects can also be resized by the user.
There are times when this functionality may not be desirable. In
those situations, you must take steps to prevent the user from
rearranging or resizing the CoolItems
.
How do I do that?
Adding
this
line to the CoolbarShellExample
following the code
that creates the last CoolItem
results in the
CoolBar
being locked and prevents the user from
rearranging or resizing the CoolItems
:
bar.setLocked(true);
Get SWT: A Developer's Notebook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.