GUI Commands User GuideVersion 2.1 |
||||||||||||||
Creating Faces ProgrammaticallyCommands and groups define various methods for retrieving and creating faces. The following summarises:
The following is an example of creating an anonymous command and programmatically setting the properties of the default face: // Create an anonymous command... ActionCommand command = new ActionCommand() { public void handleExecute() { Toolkit.getDefaultToolkit().beep(); } } // get the default face, creating it as required. Face defaultFace = command.getDefaultFace(true); defaultFace.setText("Press _Me"); defaultFace.setAccelerator(KeyStroke.getKeyStroke("control P")); // get the toolbar face, creating it as required. Face toolbarFace = command.getFace(Face.TOOLBAR, true); toolbarFace.setExtendsContext(Face.DEFAULT); toolbarFace.setIcon(icon); |
||||||||||||||