| # GUI Commands User Guide ## Version 2.1 |
| # Component Factories GUI Commands makes extensive use of factories allowing easy customisation of the components generated by the library. The factory types are as follows: ButtonFactory - Used to create general buttons. MenuFactory - Used to create menus and menu items. ToolbarFactory - Used to create toolbars and toolbar buttons. Factories can be configured globally, or on a per command basis or used on a per button basis. The following example shows installing a custom toolbar factory to be used by all commands and groups:
       ToolbarFactory customFactory = ...;
       GuiCommands.defaults().setToolbarFactory(customFactory);
The following example shows configuring specific command to use a custom button factory:
       ButtonFactory customFactory = ...;
       ActionCommand command = ...;
       command.setButtonFactory(customFactory);
And an example of using a custom menu factory for a particular button:
       MenuFactory customFactory = ...;
       ActionCommand command = ...;
       command.createMenuItem(customFactory);