SWIRL 1.1 - MenuBuilder tutorial
The SWIRL library provides a class
The actions that need to be performed by the various buttons are programmed in the usual way, using Swing
Instead of working with menu items or buttons directly, we use a simple abstraction. Buttons and menu items are represented by the same kind of objects but are rendered differently depending on their context: as text-and-icon items in a menu or as icon-only buttons in a tool bar.
One and the same object can be used in many places at the same time and then all rendered versions will be 'synchronised': for example, a toggle button and check box menu item that correspond to the same abstract object will always have the same selection state: either both or none are selected at the same time. Clicking on the toggle button will automatically change the check box state, and conversely.
We distinguish between three different kinds of object:
Note: Support for actions is more sophisticated than for the other two types. For example, changing the caption of an action after the corresponding buttons or menu items are displayed will also dynamically change the appearance of these items. On the other hand, the appearance of toggles and buttons in selection groups is fixed throughout the life time of the application.