Segmented Buttons

MacOS supports a segmented control, which is a single control containing a row of buttons that may be individually selected, either exclusively (like radio buttons) or independently (like checkboxes). VAqua does not directly support segmented controls. Instead, a segmented control is simulated using a row of adjacent JButtons and/or JToggleButtons.[1] For convenience, the VAquaClient library provides a segmented control builder that arranges and configures buttons to create a simulated segmented control.

Segmented buttons support several size options, specified using the JComponent.sizeVariant client property with values regular (the default), small, mini, or large.

Especially in recent releases of macOS, the rendering of segmented buttons depends upon whether the buttons are exclusive or independent. VAqua uses the exclusive style if the buttons are members of a button group or the Aqua.Button.isExclusiveButton client property has the value Boolean true.

VAqua supports these styles of segmented button:

Segmented

This is the default style for a segmented button. The rendering is context sensitive. A textured style is used if the button is in a JToolBar. A rounded border style is used otherwise. This style is selected by setting the JButton.buttonType client property to segmented.

Textured

A textured button has a flat background and rounded corners. Textured buttons are recommended for use in the window frame. This style is selected by setting the JButton.buttonType client property to segmentedTextured. This style is used by default if the button is in a JToolBar. A textured button indicates selection using an accent color for the text or (template) icon (instead of the inverted style) if it is not a member of a ButtonGroup, as do native textured segmented controls that support non-exclusive selection.

Separated

This style is similar to Segmented, except that the buttons are separated by a small gap. The rendering is context sensitive. A textured style is used if the button is in a JToolBar. A rounded border style is used otherwise. This style is selected by setting the JButton.buttonType client property to segmentedSeparated.

Textured Separated

This style is similar to Textured, except that the buttons are separated by a small gap. Textured buttons are recommended for use in the window frame. This style is selected by setting the JButton.buttonType client property to segmentedTexturedSeparated.

Rounded Rectangle

When not selected, a rounded rectangle button is translucent and has a border with rounded corners. This style is selected by setting the JButton.buttonType client property to segmentedRoundRect.

Gradient

This style uses square buttons similar to Gradient buttons. This style is selected by setting the JButton.buttonType client property to segmentedGradient.

[1] The details of this simulation are described in Apple Technical Note TN2196.