public class Toolbar extends javax.swing.JToolBar implements ThemedToolBar
Toolbar class is a replacement for JToolBar
specialized for use in the IDE.javax.swing.JToolBar.AccessibleJToolBar, javax.swing.JToolBar.Separatorjavax.swing.JComponent.AccessibleJComponentlistenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT| Constructor and Description |
|---|
Toolbar()
Creates an empty toolbar.
|
| Modifier and Type | Method and Description |
|---|---|
java.awt.Component |
add(java.awt.Component comp,
int index)
With the uptake of the NetBeans windowing system, menu, and toolbar,
we no longer support adding a component at a given index when adding
to the main window toolbar.
|
void |
add(java.awt.Component comp,
java.lang.Object constraints,
int index)
With the uptake of the NetBeans windowing system, menu, and toolbar,
we no longer support adding a component at a given index when adding
to the main window toolbar.
|
ToolButton |
add(ToggleAction action)
Adds a new button to the toolbar.
|
ActionMenuToolButton |
addActionMenuButton(javax.swing.Action action)
Adds a new menu button to the toolbar.
|
java.awt.Component |
addComponent(java.awt.Component component,
int index)
Adds the specified component to this toolbar at the given position.
|
void |
addFiller()
Adds a small blank space filler to the toolbar.
|
protected void |
addImpl(java.awt.Component comp,
java.lang.Object constraints,
int index) |
protected void |
addImpl2(java.awt.Component comp,
java.lang.Object constraints,
int index) |
MenuToolButton |
addMenuButton(ToggleAction[] actions)
Adds a new menu button to the toolbar.
|
void |
addNotify() |
RadioToolButton |
addRadioButton(ToggleAction action,
javax.swing.ButtonGroup bgroup)
Adds a RadioToolButton to the toolbar.
|
void |
addSeparator()
Adds a new separator to the toolbar.
|
ToggleToolButton |
addToggleButton(ToggleAction action)
Adds a toggling button to the toolbar.
|
static void |
addToolbarFilter(ActionFilter filter) |
static java.lang.String |
buildToolTip(javax.swing.Action action) |
void |
dispose()
Sets the action of each
AbstractButton contained within the
toolbar to null to avoid memory leaks. |
void |
forcePrimaryViewToolbar(boolean primaryViewToolbar)
Forces this toolbar to either use or not use the primary view toolbar
visual style in theme mode.
|
javax.swing.Action[] |
getActions() |
protected boolean |
isActionAccepted(javax.swing.Action action)
Indicates whether an action can be aded to the toolbar.
|
boolean |
isActiveToolbar()
For an application that can have active and inactive parts of the UI (like an IDE),
the active view is the area in which the user is currently working in (usually it has
focus).
|
protected boolean |
isActiveViewToolbar()
Determines whether this toolbar is the active view toolbar.
|
boolean |
isLabelVisible()
Deprecated.
No replacement.
|
boolean |
isPrimaryToolbar()
Views can sometimes have more than one toolbar.
|
java.awt.Component |
newFiller()
Create filler for use in a toolbar
|
javax.swing.JToolBar.Separator |
newSeparator()
Creates a new separator for use in the toolbar.
|
void |
paintComponent(java.awt.Graphics g) |
protected void |
processMouseEvent(java.awt.event.MouseEvent e) |
void |
remove(java.awt.Component comp) |
void |
remove(int index) |
void |
removeAll() |
void |
removeNotify() |
static void |
removeToolbarFilter(ActionFilter filter) |
void |
setLabelVisible(boolean labelVisible)
Deprecated.
Not recommended. Can be replaced with
putClientProperty("hideActionText", Boolean) on individual toolbar
buttons. |
void |
setPrimaryViewToolbar(boolean primaryViewToolbar)
Sets whether this toolbar is the primary toolbar of a view.
|
void |
setSecondaryViewToolbar(boolean secondaryViewToolbar)
Sets whether this toolbar is the secondary toolbar of a view.
|
add, addSeparator, createActionChangeListener, createActionComponent, getAccessibleContext, getComponentAtIndex, getComponentIndex, getMargin, getOrientation, getUI, getUIClassID, isBorderPainted, isFloatable, isRollover, paintBorder, paramString, setBorderPainted, setFloatable, setLayout, setMargin, setOrientation, setRollover, setUI, updateUIaddAncestorListener, 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, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, 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, updateadd, 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, removeContainerListener, setComponentZOrder, setFocusCycleRoot, 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, 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, getPeer, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic void forcePrimaryViewToolbar(boolean primaryViewToolbar)
primaryViewToolbar - if true, this toolbar will be
rendered using themes if themes are switched on.public void paintComponent(java.awt.Graphics g)
paintComponent in class javax.swing.JComponentpublic void setPrimaryViewToolbar(boolean primaryViewToolbar)
This method is normally called automatically by the IDE framework for
toolbars that are installed into views. To programmatically force a
toolbar to either use or not use the visual style, call the
forcePrimaryViewToolbar( boolean ) method.
primaryViewToolbar - if true, this toolbar will act as if
it is the primary toolbar in the view, ignoring the normal
algorithm for detecting this automatically.public void setSecondaryViewToolbar(boolean secondaryViewToolbar)
secondaryViewToolbar - if true, this toolbar will act as if
it is the secondary toolbar in the view.public final ToolButton add(ToggleAction action)
action - the action that gets executed when the button is clickedpublic java.awt.Component add(java.awt.Component comp,
int index)
add in class java.awt.Containerpublic void add(java.awt.Component comp,
java.lang.Object constraints,
int index)
add in class java.awt.Containerpublic final ToggleToolButton addToggleButton(ToggleAction action)
action - the action that gets executed when the button is clickedpublic final RadioToolButton addRadioButton(ToggleAction action, javax.swing.ButtonGroup bgroup)
action - the action that gets executed when the button is clickedbgroup - the button group to which the action belongspublic final MenuToolButton addMenuButton(ToggleAction[] actions)
actions - the actions that are shown in a popup menu when the
toolbar button is clickedpublic final ActionMenuToolButton addActionMenuButton(javax.swing.Action action)
action - the action to add to the popup toolbar buttonpublic final javax.swing.JToolBar.Separator newSeparator()
public final java.awt.Component newFiller()
public final void addSeparator()
addSeparator in class javax.swing.JToolBarpublic final void addFiller()
public java.awt.Component addComponent(java.awt.Component component,
int index)
component - the component to be addedindex - the position at which to insert the component, or -1 to
insert the component at the end@Deprecated public void setLabelVisible(boolean labelVisible)
putClientProperty("hideActionText", Boolean) on individual toolbar
buttons.@Deprecated public boolean isLabelVisible()
public javax.swing.Action[] getActions()
public void dispose()
AbstractButton contained within the
toolbar to null to avoid memory leaks.public void remove(java.awt.Component comp)
remove in class java.awt.Containerpublic void remove(int index)
remove in class java.awt.Containerpublic void removeAll()
removeAll in class java.awt.Containerprotected void addImpl(java.awt.Component comp,
java.lang.Object constraints,
int index)
addImpl in class javax.swing.JToolBarprotected void addImpl2(java.awt.Component comp,
java.lang.Object constraints,
int index)
protected void processMouseEvent(java.awt.event.MouseEvent e)
processMouseEvent in class javax.swing.JComponentpublic boolean isActiveToolbar()
ThemedToolBarisActiveToolbar in interface ThemedToolBarpublic boolean isPrimaryToolbar()
ThemedToolBarisPrimaryToolbar in interface ThemedToolBarprotected boolean isActiveViewToolbar()
This implementation checks the active view using
IdeMainWindow.getLastActiveView(). If this toolbar
instance is the toolbar of that view, then this method returns
true.
Subclasses may want to override this to provide a custom implementation,
particularly if the toolbar is not returned by the View.getToolbar()
or Editor.getScrollableTopMargin() methods.
public void addNotify()
addNotify in class javax.swing.JComponentpublic void removeNotify()
removeNotify in class javax.swing.JComponentpublic static void addToolbarFilter(ActionFilter filter)
public static void removeToolbarFilter(ActionFilter filter)
protected final boolean isActionAccepted(javax.swing.Action action)
action - The action to add to the toolbar.public static java.lang.String buildToolTip(javax.swing.Action action)