GUI Commands User GuideVersion 2.1 |
||
Face Configuration GuideFaces can be defined for both commands and groups. In both cases the syntax is identical. The following is a quick example of a typical face configuration:
paste@face.text=_Paste@default P
paste@face.icon=classpath:images/paste-icon.png
paste@face.description=\
Pastes the content of the clipboard into \
the current document ($accelerator)
This example configures the default face of the paste command. For information on context specific configuration please refer to the Face Contexts documentation. TextThe text property allows you to define the text, mnemonic and accelerator for a specific face.
The mnemonic character is simply prefixed by an underscore The following example defines a "Cut" command: cut-command@face.text=Cu_t@default X Accelerators are defined using the same syntax as Explicit Accelerator ElementYou can also define an accelerator using an explicit accelerator property. The following is an example: command@face.accelerator=default X Text PositioningText positioning is controlled via the command@face.horizontalTextPosition=trailing command@face.verticalTextPostion=bottom The allowed values for horizontal position are: The allowed values for vertical position are: IconsFaces support the full range of icons defined by Swing buttons. Icons can be loaded from the classpath, URLs and from user defined icon factories. The following demonstrates specifying the icon from each: # classpath command@face.icon=classpath:images/my-icon.png # url command@face.icon=url:http://my-server/images/my-icon.png # factory command@face.icon=factory:my-factory-parameters The following icon types are supported: The following is for your cut and paste convenience: face.icon= face.selectedIcon= face.rolloverIcon= face.rolloverSelectedIcon= face.pressedIcon= face.disabledIcon= Icon Text GapIt is also possible to specify the gap between the icon and text using the iconTextGap property. The following is an example:
# creates a 10 pixel gap between the icon and text
command@face.iconTextGap=10
Specifying an Icon FactoryPrior to loading factory based icons you must install the icon factory to be used. The factory is configured globally as follows: GuiCommands.defaults().setIconFactory(new CustomIconFactory()); The
// add a method for each icon type
public class CustomIconFactory extends AbstractReflectionIconFactory
{
public Icon createColoredIcon(String r, String g, String b)
{
return ...;
}
}
Then specify the method and parameters in your configuration.
# define a icon
command@face.icon=factory:createColoredIcon(200,127,127)
DescriptionsFaces support both a Both the
command@face.text=Hello World!!!@default H
command@face.description=Says Hello ($accelerator)
command@face.longDescription=\
This commands text is "$text" and \
the accelerator is "$accelerator".
Client PropertiesClient properties are defined using a simple map style syntax. To define
the client property command@face.text=Quaqua command@face.icon=images/smile.gif command@face.clientProperties[Quaqua.Button.style]=square |
||