Mac OS Renderer

The Mac has different conventions from most other platforms for rendering buttons and menus. GUI Commands automatically installs a special renderer on the Mac that ensures:

  • Icons and mnemonics are not displayed on menus.
  • Mnemonics are not displayed on buttons.

The following examples show how the exact same face configurations are rendered on Windows and the Mac:

Windows Menu     Mac Menu

Overriding the Default Behaviour

It is possible to override this default behaviour by configuring the static properties of the MacOSFaceRenderer class. The following example demonstrates how to do so.

   // turn menu icons and mnemonics back on for the Mac
   MacOSFaceRenderer.setMenuMnemonicsEnabled(true);
   MacOSFaceRenderer.setMenuIconsEnabled(true);

   // turn button mnemonics back on for the Mac
   MacOSFaceRenderer.setButtonMnemonicsEnabled(true);

Gotcha's

Please note that there are some issues using Apple's Aqua look and feel under certain button configurations (namely with text positioned under the icon). You may want to consider the excellent Quaqua Look and Feel to overcome these limitations.

Quaqua Integration

Toolbar Buttons

Quaqua provides the capability of rendering toolbar buttons in various styles. GUI commands provides a special property on toggle groups to automatically render toolbar buttons using Quaqua's inbuilt styles. The two available styles are rounded and tabbed. When using the rounded style, the first and last members of the toggle group are automatically configured with the toggleEast and toggleWest styles respectively.

The following example demonstrates configuring a toggle group to generate rounded buttons on toolbars:

   group!style-group@face.text=Text Styles
   group!style-group@face.clientProperties[Quaqua.Toolbar.style]=rounded
   group!style-group@toggle=true
   group!style-group@exclusive=false
   group!style-group@members=bold, italic, underline

The following image shows examples of both the rounded and tabbed toolbar styles.

Quaqua Toolbar Buttons

Using Client Properties

Both Quaqua and the standard Aqua look and feels allow you to specifiy client properties to control the appearance of buttons on the Mac. You can specify any number of client properties in your standard face configuration to control your button appearance as required. The following are examples of configuring the Aqua JButton.buttonType property:

   command@face.text=Push Me
   command@face.clientProperties[JButton.buttonType]=toggle

The list of valid styles is covered in the Java Development Guide for Mac OS X.

While the JButton.buttonType property is useful, a much greater level of control over button styles can be achieved using GUI Commands with the Quaqua look and feel. The following examples configures the Quaqua.Button.style property to render a square button. Please refer to the Quaqua User Guide for more information.

   command@face.text=Quaqua
   command@face.icon=images/smile.gif
   command@face.clientProperties[Quaqua.Button.style]=square

Square Button using Quaqua