public class JToolBar extends JComponent implements SwingConstants, Accessible
| Modifier and Type | Class and Description |
|---|---|
protected class |
JToolBar.AccessibleJToolBar
Provides the accessibility features for the
JToolBar
component. |
static class |
JToolBar.Separator
This is an extension of JSeparator used in toolbars.
|
JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BltBufferStrategy, Component.FlipBufferStrategyaccessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWBOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTBOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WESTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
JToolBar()
This method creates a new JToolBar object with horizontal orientation
and no name.
|
JToolBar(int orientation)
This method creates a new JToolBar with the given orientation and no
name.
|
JToolBar(String name)
This method creates a new JToolBar object with the given name and
horizontal orientation.
|
JToolBar(String name,
int orientation)
This method creates a new JToolBar object with the given name and
orientation.
|
| Modifier and Type | Method and Description |
|---|---|
JButton |
add(Action action)
This method adds a new JButton that performs the given Action to the
JToolBar.
|
protected void |
addImpl(Component component,
Object constraints,
int index)
This method overrides Container's addImpl method.
|
void |
addSeparator()
This method adds a Separator of default size to the JToolBar.
|
void |
addSeparator(Dimension size)
This method adds a Separator with the given size to the JToolBar.
|
protected PropertyChangeListener |
createActionChangeListener(JButton button)
This method creates a pre-configured PropertyChangeListener which updates
the control as changes are made to the Action.
|
protected JButton |
createActionComponent(Action action)
This method is used to create JButtons which can be added to the JToolBar
for the given action.
|
AccessibleContext |
getAccessibleContext()
Returns the object that provides accessibility features for this
JToolBar component. |
Component |
getComponentAtIndex(int index)
This method returns the component at the given index.
|
int |
getComponentIndex(Component component)
This method returns the index of the given component.
|
Insets |
getMargin()
This method returns the margin property.
|
int |
getOrientation()
This method returns the orientation of the JToolBar.
|
ToolBarUI |
getUI()
This method returns the UI class used to paint this JToolBar.
|
String |
getUIClassID()
This method returns the String identifier for the UI class to the used
with the JToolBar.
|
boolean |
isBorderPainted()
This method returns the borderPainted property.
|
boolean |
isFloatable()
This method returns the floatable property.
|
boolean |
isRollover()
This method returns the rollover property.
|
protected void |
paintBorder(Graphics graphics)
This method paints the border if the borderPainted property is true.
|
protected String |
paramString()
Returns a string describing the attributes for the
JToolBar
component, for use in debugging. |
void |
setBorderPainted(boolean painted)
This method sets the borderPainted property.
|
void |
setFloatable(boolean floatable)
This method sets the floatable property.
|
void |
setLayout(LayoutManager mgr)
This method sets the layout manager to be used with the JToolBar.
|
void |
setMargin(Insets margin)
This method sets the margin property.
|
void |
setOrientation(int orientation)
This method sets the orientation property for JToolBar.
|
void |
setRollover(boolean b)
This method sets the rollover property for the JToolBar.
|
void |
setUI(ToolBarUI ui)
This method sets the UI used with the JToolBar.
|
void |
updateUI()
This method resets the UI used to the Look and Feel defaults.
|
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getMinimumSize, getNextFocusableComponent, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setNextFocusableComponent, setOpaque, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, updateadd, add, add, add, add, addContainerListener, 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, setFocusTraversalKeys, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTreeaction, 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, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getFontMetrics, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, 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, processMouseEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMaximumSize, setMinimumSize, setName, setPreferredSize, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic JToolBar()
public JToolBar(int orientation)
orientation - JToolBar orientation (HORIZONTAL or VERTICAL)public JToolBar(String name)
name - Name assigned to undocked tool bar.public JButton add(Action action)
action - The Action to add to the JToolBar.protected void paintBorder(Graphics graphics)
paintBorder in class JComponentgraphics - The graphics object to paint with.JComponent.paint(java.awt.Graphics),
JComponent.paintChildren(java.awt.Graphics),
JComponent.paintComponent(java.awt.Graphics)public ToolBarUI getUI()
public void setUI(ToolBarUI ui)
ui - The UI used with the JToolBar.public void updateUI()
updateUI in class JComponentpublic String getUIClassID()
getUIClassID in class JComponentJComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()public void setRollover(boolean b)
b - The new rollover property.public boolean isRollover()
public int getComponentIndex(Component component)
component - The component to find.public Component getComponentAtIndex(int index)
index - The index of the component.public Insets getMargin()
public void setMargin(Insets margin)
margin - The margin property.public boolean isBorderPainted()
public void setBorderPainted(boolean painted)
painted - Whether the border will be painted.public boolean isFloatable()
public void setFloatable(boolean floatable)
floatable - Whether the JToolBar can be dragged.public int getOrientation()
public void setLayout(LayoutManager mgr)
public void setOrientation(int orientation)
orientation - The new orientation for JToolBar.IllegalArgumentException - If the orientation is not HORIZONTAL or
VERTICAL.public void addSeparator()
public void addSeparator(Dimension size)
size - The size of the Separator.protected JButton createActionComponent(Action action)
action - The action to create a JButton for.protected PropertyChangeListener createActionChangeListener(JButton button)
button - The JButton to configure a PropertyChangeListener for.protected void addImpl(Component component, Object constraints, int index)
protected String paramString()
JToolBar
component, for use in debugging. The return value is guaranteed to be
non-null, but the format of the string may vary between
implementations.paramString in class JComponentJToolBar.public AccessibleContext getAccessibleContext()
JToolBar component.getAccessibleContext in interface AccessiblegetAccessibleContext in class JComponentJToolBar.AccessibleJToolBar).