Package org.pushingpixels.flamingo.api.common

# Class JCommandButtonPanel

java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPanel
org.pushingpixels.flamingo.api.common.JCommandButtonPanel

All Implemented Interfaces:
  `ImageObserver`, `MenuContainer`, `Serializable`, `Accessible`, `Scrollable`

Direct Known Subclasses:
  `AbstractFileViewPanel`, `JRibbonApplicationMenuPopupPanelSecondary`

public class JCommandButtonPanel extends JPanel implements Scrollable
Panel that hosts command buttons. Provides support for button groups, single selection mode (for toggle command buttons), same icon state / dimension and column-fill / row-fill layout.

Under the default `JCommandButtonPanel.LayoutKind.ROW_FILL`, the buttons are laid out in rows, never exceeding the available horizontal space. A vertical scroll bar will kick in once there is not enough vertical space to show all the buttons. The schematic below shows a row-fill command button panel:

     +-----------------------------+-+
     |                             | |
     | +----+ +----+ +----+ +----+ | |
     | | 01 | | 02 | | 03 | | 04 | | |
     | +----+ +----+ +----+ +----+ | |
     |                             | |
     | +----+ +----+ +----+ +----+ | |
     | | 05 | | 06 | | 07 | | 07 | | |
     | +----+ +----+ +----+ +----+ | |
     |                             | |
     | +----+ +----+ +----+ +----+ | |
     | | 09 | | 10 | | 11 | | 12 | | |
     | +----+ +----+ +----+ +----+ | |
     |                             | |
     | +----+ +----+ +----+ +----+ | |
     | | 13 | | 14 | | 15 | | 16 | | |
     +-----------------------------+-+

Each row hosts four buttons, and the vertical scroll bar allows scrolling the content down.

Under the `JCommandButtonPanel.LayoutKind.COLUMN_FILL`, the buttons are laid out in columns, never exceeding the available vertical space. A horizontal scroll bar will kick in once there is not enough horizontal space to show all the buttons. The schematic below shows a column-fill command button panel:

     +---------------------------------+
     |                                 |
     | +----+ +----+ +----+ +----+ +---|
     | | 01 | | 04 | | 07 | | 10 | | 13|
     | +----+ +----+ +----+ +----+ +---|
     |                                 |
     | +----+ +----+ +----+ +----+ +---|
     | | 02 | | 05 | | 08 | | 11 | | 14|
     | +----+ +----+ +----+ +----+ +---|
     |                                 |
     | +----+ +----+ +----+ +----+ +---|
     | | 03 | | 06 | | 09 | | 12 | | 15|
     | +----+ +----+ +----+ +----+ +---|
     |                                 |
     +---------------------------------+
     +---------------------------------+

Each column hosts three buttons, and the horizontal scroll bar allows scrolling the content down.

See Also:
  - Serialized Form

## Nested Class Summary

Nested Classes
Modifier and Type
Class
Description
`static enum`
`JCommandButtonPanel.LayoutKind`
Enumerates the available layout kinds.

## Nested classes/interfaces inherited from class javax.swing.JPanel

`JPanel.AccessibleJPanel`

## Nested classes/interfaces inherited from class javax.swing.JComponent

`JComponent.AccessibleJComponent`

## Nested classes/interfaces inherited from class java.awt.Container

`Container.AccessibleAWTContainer`

## Nested classes/interfaces inherited from class java.awt.Component

`Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected CommandToggleButtonGroup`
`buttonGroup`
The button group for the single selection mode.
`protected List<List<AbstractCommandButton>>`
`buttons`
List of all button groups.
`protected int`
`currDimension`
Current icon dimension.
`protected CommandButtonDisplayState`
`currState`
Current icon state.
`protected List<String>`
`groupTitles`
List of titles for all button groups.
`protected boolean`
`isSingleSelectionMode`
Indicates the selection mode for the `JCommandToggleButton` in this panel.
`protected JCommandButtonPanel.LayoutKind`
`layoutKind`
Layout kind of this button panel.
`protected int`
`maxButtonColumns`
Maximum number of columns for this panel.
`protected int`
`maxButtonRows`
Maximum number of rows for this panel.
`protected boolean`
`toShowGroupLabels`
If `true`, the panel will show group labels.
`static final String`
`uiClassID`

### Fields inherited from class javax.swing.JComponent

`listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW`

### Fields inherited from class java.awt.Component

`accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT`

### Fields inherited from interface java.awt.image.ImageObserver

`ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH`

## Constructor Summary

Constructors
Modifier
Constructor
Description
`protected`
`JCommandButtonPanel()`
Creates a new panel.
``
`JCommandButtonPanel(int startingDimension)`
Creates a new panel.
``
`JCommandButtonPanel(CommandButtonDisplayState startingState)`
Creates a new panel.

## Method Summary

Modifier and Type
Method
Description
`void`
`addButtonGroup(String buttonGroupName)`
Adds a new button group after all the existing button groups.
`void`
`addButtonGroup(String buttonGroupName, int groupIndex)`
Adds a new button group at the specified index.
`int`
`addButtonToGroup(String buttonGroupName, int indexInGroup, AbstractCommandButton commandButton)`
Adds a new button to the specified button group.
`int`
`addButtonToGroup(String buttonGroupName, AbstractCommandButton commandButton)`
Adds a new button to the specified button group.
`int`
`addButtonToLastGroup(AbstractCommandButton commandButton)`
Adds a new button to the specified button group.
`void`
`addChangeListener(ChangeListener l)`
Adds the specified change listener to this button panel.
`protected void`
`fireStateChanged()`
Notifies all registered listener that the state of this command button panel has changed.
`int`
`getButtonCount()`
Returns the number of buttons in this panel.
`List<AbstractCommandButton>`
`getGroupButtons(int groupIndex)`
Returns the list of all buttons in the specified button group.
`int`
`getGroupCount()`
Returns the number of button groups in this panel.
`String`
`getGroupTitleAt(int index)`
Returns the title of the button group at the specified index.
`JCommandButtonPanel.LayoutKind`
`getLayoutKind()`
Returns the layout kind of this panel.
`int`
`getMaxButtonColumns()`
Returns the maximum button columns for this panel.
`int`
`getMaxButtonRows()`
Returns the maximum button rows for this panel.
`Dimension`
`getPreferredScrollableViewportSize()`
`int`
`getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)`
`boolean`
`getScrollableTracksViewportHeight()`
`boolean`
`getScrollableTracksViewportWidth()`
`int`
`getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)`
`JCommandToggleButton`
`getSelectedButton()`
Returns the selected button of this panel.
`String`
`getUIClassID()`
`boolean`
`isToShowGroupLabels()`
Returns indication whether button group labels should be shown.
`void`
`removeAllGroups()`
Removes all the button groups and buttons from this panel.
`void`
`removeButtonFromGroup(String buttonGroupName, int indexInGroup)`
Removes the button at the specified index from the specified button group.
`void`
`removeButtonGroup(String buttonGroupName)`
Removes the specified button group.
`void`
`removeChangeListener(ChangeListener l)`
Removes the specified change listener from this button panel.
`void`
`setIconDimension(int dimension)`
Sets the new dimension for the icons in this panel.
`void`
`setIconState(CommandButtonDisplayState state)`
Sets the new state for the icons in this panel.
`void`
`setLayoutKind(JCommandButtonPanel.LayoutKind layoutKind)`
Sets the new layout kind for this panel.
`void`
`setMaxButtonColumns(int maxButtonColumns)`
Sets the maximum button columns for this panel.
`void`
`setMaxButtonRows(int maxButtonRows)`
Sets the maximum button rows for this panel.
`void`
`setSingleSelectionMode(boolean isSingleSelectionMode)`
Sets the selection mode for this panel.
`void`
`setToShowGroupLabels(boolean toShowGroupLabels)`
Sets indication whether button group labels should be shown.
`void`
`updateUI()`

### Methods inherited from class javax.swing.JPanel

`getAccessibleContext, getUI, paramString, setUI`

### Methods inherited from class javax.swing.JComponent

`addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update`

### Methods inherited from class java.awt.Container

`add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree`

### Methods inherited from class java.awt.Component

`action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle`

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### uiClassID

public static final String uiClassID

See Also:
  - `getUIClassID()`
  - Constant Field Values

### groupTitles

protected List<String> groupTitles
List of titles for all button groups.

See Also:
  - `getGroupCount()`
  - `getGroupTitleAt(int)`

### buttons

protected List<List<AbstractCommandButton>> buttons
List of all button groups.

See Also:
  - `getGroupCount()`
  - `getGroupButtons(int)`

### maxButtonColumns

protected int maxButtonColumns
Maximum number of columns for this panel. Relevant only when the layout kind is `JCommandButtonPanel.LayoutKind.ROW_FILL`.

See Also:
  - `getMaxButtonColumns()`
  - `setMaxButtonColumns(int)`

### maxButtonRows

protected int maxButtonRows
Maximum number of rows for this panel. Relevant only when the layout kind is `JCommandButtonPanel.LayoutKind.COLUMN_FILL`.

See Also:
  - `getMaxButtonRows()`
  - `setMaxButtonRows(int)`

### isSingleSelectionMode

protected boolean isSingleSelectionMode
Indicates the selection mode for the `JCommandToggleButton` in this panel.

See Also:
  - `setSingleSelectionMode(boolean)`

### toShowGroupLabels

protected boolean toShowGroupLabels
If `true`, the panel will show group labels.

See Also:
  - `setToShowGroupLabels(boolean)`
  - `isToShowGroupLabels()`

### buttonGroup

protected CommandToggleButtonGroup buttonGroup
The button group for the single selection mode.

### currDimension

protected int currDimension
Current icon dimension.

### currState

protected CommandButtonDisplayState currState
Current icon state.

### layoutKind

protected JCommandButtonPanel.LayoutKind layoutKind
Layout kind of this button panel.

See Also:
  - `getLayoutKind()`
  - `setLayoutKind(LayoutKind)`

## Constructor Details

### JCommandButtonPanel

protected JCommandButtonPanel()
Creates a new panel.

### JCommandButtonPanel

public JCommandButtonPanel(int startingDimension)
Creates a new panel.

Parameters:
  `startingDimension` - Initial dimension for buttons.

### JCommandButtonPanel

public JCommandButtonPanel(CommandButtonDisplayState startingState)
Creates a new panel.

Parameters:
  `startingState` - Initial state for buttons.

## Method Details

### addButtonGroup

public void addButtonGroup(String buttonGroupName, int groupIndex)
Adds a new button group at the specified index.

Parameters:
  `buttonGroupName` - Button group name.
  `groupIndex` - Button group index.
See Also:
  - `addButtonGroup(String)`
  - `removeButtonGroup(String)`
  - `removeAllGroups()`

### addButtonGroup

public void addButtonGroup(String buttonGroupName)
Adds a new button group after all the existing button groups.

Parameters:
  `buttonGroupName` - Button group name.
See Also:
  - `addButtonGroup(String, int)`
  - `removeButtonGroup(String)`
  - `removeAllGroups()`

### removeButtonGroup

public void removeButtonGroup(String buttonGroupName)
Removes the specified button group.

Parameters:
  `buttonGroupName` - Name of the button group to remove.
See Also:
  - `addButtonGroup(String)`
  - `addButtonGroup(String, int)`
  - `removeAllGroups()`

### addButtonToLastGroup

public int addButtonToLastGroup(AbstractCommandButton commandButton)
Adds a new button to the specified button group.

Parameters:
  `commandButton` - Button to add.
Returns:
  Returns the index of the button on the specified group, or -1 if no such group exists.
See Also:
  - `addButtonToGroup(String, AbstractCommandButton)`
  - `addButtonToGroup(String, int, AbstractCommandButton)`
  - `removeButtonFromGroup(String, int)`

### addButtonToGroup

public int addButtonToGroup(String buttonGroupName, AbstractCommandButton commandButton)
Adds a new button to the specified button group.

Parameters:
  `buttonGroupName` - Name of the button group.
  `commandButton` - Button to add.
Returns:
  Returns the index of the button on the specified group, or -1 if no such group exists.
See Also:
  - `addButtonToGroup(String, int, AbstractCommandButton)`
  - `addButtonToLastGroup(AbstractCommandButton)`
  - `removeButtonFromGroup(String, int)`

### addButtonToGroup

public int addButtonToGroup(String buttonGroupName, int indexInGroup, AbstractCommandButton commandButton)
Adds a new button to the specified button group.

Parameters:
  `buttonGroupName` - Name of the button group.
  `indexInGroup` - Index of the button in group.
  `commandButton` - Button to add.
Returns:
  Returns the index of the button on the specified group, or -1 if no such group exists.
See Also:
  - `addButtonToGroup(String, int, AbstractCommandButton)`
  - `addButtonToLastGroup(AbstractCommandButton)`
  - `removeButtonFromGroup(String, int)`

### removeButtonFromGroup

public void removeButtonFromGroup(String buttonGroupName, int indexInGroup)
Removes the button at the specified index from the specified button group.

Parameters:
  `buttonGroupName` - Name of the button group.
  `indexInGroup` - Index of the button to remove.
See Also:
  - `addButtonToGroup(String, AbstractCommandButton)`
  - `addButtonToGroup(String, int, AbstractCommandButton)`
  - `addButtonToLastGroup(AbstractCommandButton)`

### removeAllGroups

public void removeAllGroups()
Removes all the button groups and buttons from this panel.

See Also:
  - `addButtonGroup(String, int)`
  - `addButtonGroup(String)`
  - `removeButtonGroup(String)`
  - `removeButtonFromGroup(String, int)`

### getGroupCount

public int getGroupCount()
Returns the number of button groups in this panel.

Returns:
  Number of button groups in this panel.

### getButtonCount

public int getButtonCount()
Returns the number of buttons in this panel.

Returns:
  Number of buttons in this panel.

### getGroupTitleAt

public String getGroupTitleAt(int index)
Returns the title of the button group at the specified index.

Parameters:
  `index` - Button group index.
Returns:
  Title of the button group at the specified index.

### updateUI

public void updateUI()

Overrides:
  `updateUI` in class `JPanel`

### getUIClassID

public String getUIClassID()

Overrides:
  `getUIClassID` in class `JPanel`

### setMaxButtonColumns

public void setMaxButtonColumns(int maxButtonColumns)
Sets the maximum button columns for this panel. When this panel is shown and the layout kind is `JCommandButtonPanel.LayoutKind.ROW_FILL`, it will have no more than this number of buttons in each row. Fires a `maxButtonColumns` property change event.

Parameters:
  `maxButtonColumns` - Maximum button columns for this panel.
See Also:
  - `getMaxButtonColumns()`
  - `setMaxButtonRows(int)`

### getMaxButtonColumns

public int getMaxButtonColumns()
Returns the maximum button columns for this panel. The return value is relevant only when the layout kind is `JCommandButtonPanel.LayoutKind.ROW_FILL`.

Returns:
  Maximum button columns for this panel.
See Also:
  - `setMaxButtonColumns(int)`
  - `getMaxButtonRows()`

### setMaxButtonRows

public void setMaxButtonRows(int maxButtonRows)
Sets the maximum button rows for this panel. When this panel is shown and the layout kind is `JCommandButtonPanel.LayoutKind.COLUMN_FILL`, it will have no more than this number of buttons in each column. Fires a `maxButtonRows` property change event.

Parameters:
  `maxButtonRows` - Maximum button rows for this panel.
See Also:
  - `getMaxButtonRows()`
  - `setMaxButtonColumns(int)`

### getMaxButtonRows

public int getMaxButtonRows()
Returns the maximum button rows for this panel. The return value is relevant only when the layout kind is `JCommandButtonPanel.LayoutKind.COLUMN_FILL`.

Returns:
  Maximum button rows for this panel.
See Also:
  - `setMaxButtonRows(int)`
  - `getMaxButtonColumns()`

### getGroupButtons

public List<AbstractCommandButton> getGroupButtons(int groupIndex)
Returns the list of all buttons in the specified button group.

Parameters:
  `groupIndex` - Group index.
Returns:
  Unmodifiable view on the list of all buttons in the specified button group.
See Also:
  - `getGroupCount()`

### setSingleSelectionMode

public void setSingleSelectionMode(boolean isSingleSelectionMode)
Sets the selection mode for this panel. If `true` is passed as the parameter, all `JCommandToggleButton` in this panel are set to belong to the same button group.

Parameters:
  `isSingleSelectionMode` - If `true`,all `JCommandToggleButton` in this panel are set to belong to the same button group.
See Also:
  - `getSelectedButton()`

### setToShowGroupLabels

public void setToShowGroupLabels(boolean toShowGroupLabels)
Sets indication whether button group labels should be shown. Fires a `toShowGroupLabels` property change event.

Parameters:
  `toShowGroupLabels` - If `true`, this panel will show the labels of the button groups.
See Also:
  - `isToShowGroupLabels()`

### isToShowGroupLabels

public boolean isToShowGroupLabels()
Returns indication whether button group labels should be shown.

Returns:
  If `true`, this panel shows the labels of the button groups, and `false` otherwise.
See Also:
  - `setToShowGroupLabels(boolean)`

### setIconDimension

public void setIconDimension(int dimension)
Sets the new dimension for the icons in this panel. The state for all the icons is set to `CommandButtonDisplayState.FIT_TO_ICON`.

Parameters:
  `dimension` - New dimension for the icons in this panel.
See Also:
  - `setIconState(CommandButtonDisplayState)`

### setIconState

public void setIconState(CommandButtonDisplayState state)
Sets the new state for the icons in this panel. The dimension for all the icons is set to -1; this method should only be called with a state that has an associated default size (like `CommandButtonDisplayState.BIG`, `CommandButtonDisplayState.TILE`, `CommandButtonDisplayState.MEDIUM` and `CommandButtonDisplayState.SMALL`).

Parameters:
  `state` - New state for the icons in this panel.
See Also:
  - `setIconDimension(int)`

### getSelectedButton

public JCommandToggleButton getSelectedButton()
Returns the selected button of this panel. Only relevant for single selection mode (set by `setSingleSelectionMode(boolean)`), returning `null` otherwise.

Returns:
  The selected button of this panel.
See Also:
  - `setSingleSelectionMode(boolean)`

### getLayoutKind

public JCommandButtonPanel.LayoutKind getLayoutKind()
Returns the layout kind of this panel.

Returns:
  Layout kind of this panel.
See Also:
  - `setLayoutKind(LayoutKind)`

### setLayoutKind

public void setLayoutKind(JCommandButtonPanel.LayoutKind layoutKind)
Sets the new layout kind for this panel. Fires a `layoutKind` property change event.

Parameters:
  `layoutKind` - New layout kind for this panel.
See Also:
  - `getLayoutKind()`

### addChangeListener

public void addChangeListener(ChangeListener l)
Adds the specified change listener to this button panel.

Parameters:
  `l` - Change listener to add.
See Also:
  - `removeChangeListener(ChangeListener)`

### removeChangeListener

public void removeChangeListener(ChangeListener l)
Removes the specified change listener from this button panel.

Parameters:
  `l` - Change listener to remove.
See Also:
  - `addChangeListener(ChangeListener)`

### fireStateChanged

protected void fireStateChanged()
Notifies all registered listener that the state of this command button panel has changed.

### getPreferredScrollableViewportSize

public Dimension getPreferredScrollableViewportSize()

Specified by:
  `getPreferredScrollableViewportSize` in interface `Scrollable`

### getScrollableBlockIncrement

public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)

Specified by:
  `getScrollableBlockIncrement` in interface `Scrollable`

### getScrollableTracksViewportHeight

public boolean getScrollableTracksViewportHeight()

Specified by:
  `getScrollableTracksViewportHeight` in interface `Scrollable`

### getScrollableTracksViewportWidth

public boolean getScrollableTracksViewportWidth()

Specified by:
  `getScrollableTracksViewportWidth` in interface `Scrollable`

### getScrollableUnitIncrement

public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)

Specified by:
  `getScrollableUnitIncrement` in interface `Scrollable`