Class 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