public class JRibbonBand extends AbstractRibbonBand<JBandControlPanel>
addCommandButton(AbstractCommandButton, RibbonElementPriority)
.addRibbonComponent(JRibbonComponent)
or
addRibbonComponent(JRibbonComponent, int)
.addRibbonGallery(String, List, Map, int, int, RibbonElementPriority)
.
Command buttons are added with associated RibbonElementPriority
. The
higher the priority, the longer the button "stays" in the
CommandButtonDisplayState.BIG
or
CommandButtonDisplayState.MEDIUM
state - depending on the available
resize policies.
Wrapped components can span one or multiple rows. Use the
addRibbonComponent(JRibbonComponent, int)
API to add a wrapped
component that spans more than one row.
Once a ribbon gallery is added with
addRibbonGallery(String, List, Map, int, int, RibbonElementPriority)
, you can use the following APIs to configure the content and behavior of
that gallery:
addRibbonGalleryButtons(String, String, JCommandToggleButton...)
removeRibbonGalleryButtons(String, JCommandToggleButton...)
setSelectedRibbonGalleryButton(String, JCommandToggleButton)
setRibbonGalleryExpandKeyTip(String, String)
setRibbonGalleryPopupCallback(String, RibbonGalleryPopupCallback)
A ribbon band can have multiple visual groups separated with vertical
separator lines. To start a new unnamed group use the startGroup()
API. To start a new named group use the startGroup(String)
API.
Unnamed groups will have three rows of controls. Named groups will have two
rows of controls, with the top row showing the group title.
Modifier and Type | Class | Description |
---|---|---|
static interface |
JRibbonBand.RibbonGalleryPopupCallback |
This callback allows application code to place additional menu entries in
the popup menu shown when the ribbon gallery expand button is clicked.
|
java.awt.Component.AccessibleAWTComponent, java.awt.Component.BaselineResizeBehavior, java.awt.Component.BltBufferStrategy, java.awt.Component.FlipBufferStrategy
Modifier and Type | Field | Description |
---|---|---|
static CommandButtonDisplayState |
BIG_FIXED |
Big size with landscape orientation.
|
static CommandButtonDisplayState |
BIG_FIXED_LANDSCAPE |
Big size with landscape orientation.
|
controlPanel, resizePolicies, uiClassID
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
Constructor | Description |
---|---|
JRibbonBand(java.lang.String title,
ResizableIcon icon) |
Constructs a
JRibbonBand specifying the title and the icon
when in the collapsed state. |
JRibbonBand(java.lang.String title,
ResizableIcon icon,
java.awt.event.ActionListener expandActionListener) |
Constructs a
JRibbonBand specifying the title, the icon when
in the collapsed state, and the action listener for when the band is
expanded. |
Modifier and Type | Method | Description |
---|---|---|
void |
addCommandButton(AbstractCommandButton commandButton,
RibbonElementPriority priority) |
Adds the specified command button to
this band. |
void |
addRibbonComponent(JRibbonComponent comp) |
Adds the specified ribbon component to this ribbon band.
|
void |
addRibbonComponent(JRibbonComponent comp,
int rowSpan) |
Adds the specified ribbon component to this ribbon band.
|
void |
addRibbonGallery(java.lang.String galleryName,
java.util.List<StringValuePair<java.util.List<JCommandToggleButton>>> buttons,
java.util.Map<RibbonElementPriority,java.lang.Integer> preferredVisibleButtonCounts,
int preferredPopupMaxButtonColumns,
int preferredPopupMaxVisibleButtonRows,
CommandButtonDisplayState ribbonButtonDisplayState,
RibbonElementPriority priority) |
Adds a new ribbon gallery to
this band. |
void |
addRibbonGallery(java.lang.String galleryName,
java.util.List<StringValuePair<java.util.List<JCommandToggleButton>>> buttons,
java.util.Map<RibbonElementPriority,java.lang.Integer> preferredVisibleButtonCounts,
int preferredPopupMaxButtonColumns,
int preferredPopupMaxVisibleButtonRows,
RibbonElementPriority priority) |
|
void |
addRibbonGallery(JRibbonGallery gallery) |
Adds the
gallery to the ribbon band with a priority of
RibbonElementPriority.TOP . |
void |
addRibbonGallery(JRibbonGallery gallery,
RibbonElementPriority priority) |
Adds the
gallery to the ribbon band with the specified
priority . |
void |
addRibbonGalleryButtons(java.lang.String galleryName,
java.lang.String buttonGroupName,
JCommandToggleButton... buttons) |
Adds the specified command toggle buttons to a button group in the
specified ribbon gallery.
|
AbstractRibbonBand<JBandControlPanel> |
cloneBand() |
Returns a clone of this ribbon band.
|
java.util.List<JRibbonComponent> |
getRibbonComponents(int groupIndex) |
|
void |
removeRibbonGalleryButtons(java.lang.String galleryName,
JCommandToggleButton... buttons) |
Removes command toggle buttons from the specified ribbon gallery.
|
void |
setGroupTitle(int groupIndex,
java.lang.String groupTitle) |
Changes the title of the specified group.
|
void |
setRibbonGalleryButtonDisplayState(java.lang.String galleryName,
CommandButtonDisplayState displayState) |
Sets the display state for the buttons of the specified ribbon gallery.
|
void |
setRibbonGalleryExpandKeyTip(java.lang.String galleryName,
java.lang.String expandKeyTip) |
Sets the key tip on the expand button of the specified ribbon gallery.
|
void |
setRibbonGalleryPopupCallback(java.lang.String galleryName,
JRibbonBand.RibbonGalleryPopupCallback popupCallback) |
Sets the application callback to place additional entries in the popup
menu shown when the specified ribbon gallery is expanded.
|
void |
setSelectedRibbonGalleryButton(java.lang.String galleryName,
JCommandToggleButton buttonToSelect) |
Selects the specified command toggle button in the specified ribbon
gallery.
|
int |
startGroup() |
Starts a new unnamed group.
|
int |
startGroup(java.lang.String groupTitle) |
Starts a new named group.
|
getCollapsedStateKeyTip, getControlPanel, getCurrentResizePolicy, getExpandActionListener, getExpandButtonKeyTip, getExpandButtonRichTooltip, getIcon, getPopupRibbonBand, getResizePolicies, getTitle, getUI, getUIClassID, setCollapsedStateKeyTip, setControlPanel, setCurrentResizePolicy, setExpandActionListener, setExpandButtonKeyTip, setExpandButtonRichTooltip, setIcon, setPopupRibbonBand, setResizePolicies, setTitle, setUI, updateUI
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, getAccessibleContext, 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
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
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, paramString, 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
public static final CommandButtonDisplayState BIG_FIXED_LANDSCAPE
public static final CommandButtonDisplayState BIG_FIXED
public JRibbonBand(java.lang.String title, ResizableIcon icon)
JRibbonBand
specifying the title and the icon
when in the collapsed state.
This is equivalent to JRibbonBand(title, icon, null)
.
title
- band titleicon
- the icon displayed when the band collapsesJRibbonBand(String, ResizableIcon, ActionListener)
public JRibbonBand(java.lang.String title, ResizableIcon icon, java.awt.event.ActionListener expandActionListener)
JRibbonBand
specifying the title, the icon when
in the collapsed state, and the action listener for when the band is
expanded.title
- band titleicon
- the icon displayed when the band collapsesexpandActionListener
- Expand action listener (can be null
).public void addCommandButton(AbstractCommandButton commandButton, RibbonElementPriority priority)
this
band.commandButton
- the command button to addpriority
- priority of the buttonpublic void addRibbonGallery(java.lang.String galleryName, java.util.List<StringValuePair<java.util.List<JCommandToggleButton>>> buttons, java.util.Map<RibbonElementPriority,java.lang.Integer> preferredVisibleButtonCounts, int preferredPopupMaxButtonColumns, int preferredPopupMaxVisibleButtonRows, RibbonElementPriority priority)
public void addRibbonGallery(java.lang.String galleryName, java.util.List<StringValuePair<java.util.List<JCommandToggleButton>>> buttons, java.util.Map<RibbonElementPriority,java.lang.Integer> preferredVisibleButtonCounts, int preferredPopupMaxButtonColumns, int preferredPopupMaxVisibleButtonRows, CommandButtonDisplayState ribbonButtonDisplayState, RibbonElementPriority priority)
this
band.galleryName
- Gallery name.buttons
- Button groups.preferredVisibleButtonCounts
- Preferred count of visible buttons of the ribbon gallery under
different states.preferredPopupMaxButtonColumns
- Preferred maximum columns in the popup gallery associated with
the ribbon gallery.preferredPopupMaxVisibleButtonRows
- Preferred maximum visible rows in the popup gallery associated
with the ribbon gallery.priority
- The initial ribbon gallery priority.addRibbonGalleryButtons(String, String, JCommandToggleButton...)
,
removeRibbonGalleryButtons(String, JCommandToggleButton...)
,
setSelectedRibbonGalleryButton(String, JCommandToggleButton)
public void addRibbonGalleryButtons(java.lang.String galleryName, java.lang.String buttonGroupName, JCommandToggleButton... buttons)
galleryName
- Ribbon gallery name.buttonGroupName
- Button group name.buttons
- Buttons to add.addRibbonGallery(String, List, Map, int, int,
RibbonElementPriority)
,
removeRibbonGalleryButtons(String, JCommandToggleButton...)
,
setSelectedRibbonGalleryButton(String, JCommandToggleButton)
public void addRibbonGallery(JRibbonGallery gallery)
gallery
to the ribbon band with a priority of
RibbonElementPriority.TOP
.gallery
- the ribbon gallerypublic void addRibbonGallery(JRibbonGallery gallery, RibbonElementPriority priority)
gallery
to the ribbon band with the specified
priority
.gallery
- the ribbon gallerypriority
- the gallery prioritypublic void removeRibbonGalleryButtons(java.lang.String galleryName, JCommandToggleButton... buttons)
galleryName
- Ribbon gallery name.buttons
- Buttons to remove.addRibbonGallery(String, List, Map, int, int,
RibbonElementPriority)
,
addRibbonGalleryButtons(String, String, JCommandToggleButton...)
,
setSelectedRibbonGalleryButton(String, JCommandToggleButton)
public void setSelectedRibbonGalleryButton(java.lang.String galleryName, JCommandToggleButton buttonToSelect)
galleryName
- Ribbon gallery name.buttonToSelect
- Button to select.addRibbonGallery(String, List, Map, int, int,
RibbonElementPriority)
,
addRibbonGalleryButtons(String, String, JCommandToggleButton...)
,
removeRibbonGalleryButtons(String, JCommandToggleButton...)
public void setRibbonGalleryButtonDisplayState(java.lang.String galleryName, CommandButtonDisplayState displayState)
galleryName
- Ribbon gallery name.displayState
- Display state for the buttons of the matching ribbon gallery.public void setRibbonGalleryPopupCallback(java.lang.String galleryName, JRibbonBand.RibbonGalleryPopupCallback popupCallback)
galleryName
- Gallery name.popupCallback
- Application callback.JRibbonBand.RibbonGalleryPopupCallback
public void setRibbonGalleryExpandKeyTip(java.lang.String galleryName, java.lang.String expandKeyTip)
galleryName
- Gallery name.expandKeyTip
- The key tip on the expand button of the specified ribbon
gallery.public void addRibbonComponent(JRibbonComponent comp)
comp
- The ribbon component to add.public void addRibbonComponent(JRibbonComponent comp, int rowSpan)
comp
- The ribbon component to add.rowSpan
- Row span of the ribbon component.java.lang.IllegalArgumentException
- if the row span is not legal. Legal row span is 1..3 for
unnamed groups and 1..2 for named groups.startGroup()
,
startGroup(String)
public int startGroup()
public int startGroup(java.lang.String groupTitle)
groupTitle
- The group title.public void setGroupTitle(int groupIndex, java.lang.String groupTitle)
groupIndex
- Group index.groupTitle
- The new title for this group.public java.util.List<JRibbonComponent> getRibbonComponents(int groupIndex)
public AbstractRibbonBand<JBandControlPanel> cloneBand()
AbstractRibbonBand
cloneBand
in class AbstractRibbonBand<JBandControlPanel>