| # GUI Commands User Guide ## Version 2.1 |
| # Programmatic Configuration Like ActionCommands, CommandGroups can be created from scratch programmatically as anonymous groups. Anonymous groups have the same constraints as anonymous ActionCommands in that: They must be configured programmatically before creating buttons and menu items. They can't be automatically included in other groups. Adding members programmatically is covered in detail in the Group Builders section. Adding faces is covered in Creating Faces Programmatically. The following is an example of creating an anonymous group and configuring it programmatically:
       // create an anonymous group
       CommandGroup group = new CommandGroup();
       // configure the default face
       group.getDefaultFace(true).setText("My Group");

       // get a builder and add some commands.
       GroupBuilder builder = group.getBuilder();
       builder.add(aCommand);
       builder.add(anotherGroup);
       builder.applyChanges();