Class BasicToolBarUI
- All Implemented Interfaces:
SwingConstants
- Direct Known Subclasses:
-
MetalToolBarUI
,SynthToolBarUI
public class BasicToolBarUI extends ToolBarUI implements SwingConstants
Nested Class Summary
Modifier and Type | Class | Description |
---|---|---|
class |
BasicToolBarUI.DockingListener |
This class should be treated as a "protected" inner class. |
protected class |
BasicToolBarUI.DragWindow |
The window which appears during dragging the JToolBar . |
protected class |
BasicToolBarUI.FrameListener |
The class listens for window events. |
protected class |
BasicToolBarUI.PropertyListener |
The class listens for property changed events. |
protected class |
BasicToolBarUI.ToolBarContListener |
The class listens for component events. |
protected class |
BasicToolBarUI.ToolBarFocusListener |
The class listens for focus events. |
Field Summary
Modifier and Type | Field | Description |
---|---|---|
protected String |
constraintBeforeFloating |
The layout before floating. |
protected Color |
dockingBorderColor |
The color of the docking border. |
protected Color |
dockingColor |
The background color of the docking border. |
protected MouseInputListener |
dockingListener |
The instance of a MouseInputListener . |
protected KeyStroke |
downKey |
Deprecated. As of Java 2 platform v1.3. |
protected BasicToolBarUI.DragWindow |
dragWindow |
The instance of DragWindow . |
protected Color |
floatingBorderColor |
The color of the not docking border. |
protected Color |
floatingColor |
The background color of the not docking border. |
protected int |
focusedCompIndex |
The index of the focused component. |
protected KeyStroke |
leftKey |
Deprecated. As of Java 2 platform v1.3. |
protected PropertyChangeListener |
propertyListener |
The instance of a PropertyChangeListener . |
protected KeyStroke |
rightKey |
Deprecated. As of Java 2 platform v1.3. |
protected JToolBar |
toolBar |
The instance of JToolBar . |
protected ContainerListener |
toolBarContListener |
The instance of a ContainerListener . |
protected FocusListener |
toolBarFocusListener |
The instance of a FocusListener . |
protected KeyStroke |
upKey |
Deprecated. As of Java 2 platform v1.3. |
Fields declared in interface javax.swing.SwingConstants
BOTTOM, CENTER, EAST, HORIZONTAL, LEADING, LEFT, NEXT, NORTH, NORTH_EAST, NORTH_WEST, PREVIOUS, RIGHT, SOUTH, SOUTH_EAST, SOUTH_WEST, TOP, TRAILING, VERTICAL, WEST
Constructor Summary
Constructor | Description |
---|---|
BasicToolBarUI() |
Constructs a BasicToolBarUI . |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
boolean |
canDock |
Returns true if the JToolBar can dock at the given position. |
protected MouseInputListener |
createDockingListener() |
Returns an instance of MouseInputListener . |
protected BasicToolBarUI.DragWindow |
createDragWindow |
Returns an instance of DragWindow . |
protected JFrame |
createFloatingFrame |
Deprecated. It is recommended that createFloatingWindow(JToolBar) be used instead |
protected RootPaneContainer |
createFloatingWindow |
Creates a window which contains the toolbar after it has been dragged out from its container |
protected WindowListener |
createFrameListener() |
Constructs a new instance of WindowListener . |
protected Border |
createNonRolloverBorder() |
Creates the non rollover border for toolbar components. |
protected PropertyChangeListener |
createPropertyListener() |
Returns an instance of PropertyChangeListener . |
protected Border |
createRolloverBorder() |
Creates a rollover border for toolbar components. |
protected ContainerListener |
createToolBarContListener() |
Returns an instance of ContainerListener . |
protected FocusListener |
createToolBarFocusListener() |
Returns an instance of FocusListener . |
static ComponentUI |
createUI |
Constructs a new instance of BasicToolBarUI . |
protected void |
dragTo |
The method is used to drag DragWindow during the JToolBar is being dragged. |
protected void |
floatAt |
The method is called at end of dragging to place the frame in either its original place or in its floating frame. |
Color |
getDockingColor() |
Gets the color displayed when over a docking area |
Color |
getFloatingColor() |
Gets the color displayed when over a floating area |
protected Border |
getNonRolloverBorder |
Returns a non-rollover border for the button. |
protected Border |
getRolloverBorder |
Returns a rollover border for the button. |
protected void |
installComponents() |
Registers components. |
protected void |
installDefaults() |
Installs default properties. |
protected void |
installKeyboardActions() |
Registers keyboard actions. |
protected void |
installListeners() |
Registers listeners. |
protected void |
installNonRolloverBorders |
Installs non-rollover borders on all the child components of the JComponent. |
protected void |
installNormalBorders |
Installs normal borders on all the child components of the JComponent. |
protected void |
installRolloverBorders |
Installs rollover borders on all the child components of the JComponent. |
boolean |
isFloating() |
Returns true if the JToolBar is floating |
boolean |
isRolloverBorders() |
Returns a flag to determine whether rollover button borders are enabled. |
protected void |
navigateFocusedComp |
Navigates the focused component. |
protected void |
paintDragWindow |
Paints the contents of the window used for dragging. |
protected void |
setBorderToNonRollover |
Sets the border of the component to have a non-rollover border which was created by the createNonRolloverBorder() method. |
protected void |
setBorderToNormal |
Sets the border of the component to have a normal border. |
protected void |
setBorderToRollover |
Sets the border of the component to have a rollover border which was created by the createRolloverBorder() method. |
void |
setDockingColor |
Sets the color displayed when over a docking area |
void |
setFloating |
Sets the floating property. |
void |
setFloatingColor |
Sets the color displayed when over a floating area |
void |
setFloatingLocation |
Sets the floating location. |
void |
setOrientation |
Sets the tool bar's orientation. |
void |
setRolloverBorders |
Sets the flag for enabling rollover borders on the toolbar and it will also install the appropriate border depending on the state of the flag. |
protected void |
uninstallComponents() |
Unregisters components. |
protected void |
uninstallDefaults() |
Uninstalls default properties. |
protected void |
uninstallKeyboardActions() |
Unregisters keyboard actions. |
protected void |
uninstallListeners() |
Unregisters listeners. |
Methods declared in class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
Field Details
toolBar
protected JToolBar toolBar
JToolBar
.dragWindow
protected BasicToolBarUI.DragWindow dragWindow
DragWindow
.focusedCompIndex
protected int focusedCompIndex
dockingColor
protected Color dockingColor
floatingColor
protected Color floatingColor
dockingBorderColor
protected Color dockingBorderColor
floatingBorderColor
protected Color floatingBorderColor
dockingListener
protected MouseInputListener dockingListener
MouseInputListener
.propertyListener
protected PropertyChangeListener propertyListener
PropertyChangeListener
.toolBarContListener
protected ContainerListener toolBarContListener
ContainerListener
.toolBarFocusListener
protected FocusListener toolBarFocusListener
FocusListener
.constraintBeforeFloating
protected String constraintBeforeFloating
upKey
@Deprecated protected KeyStroke upKey
downKey
@Deprecated protected KeyStroke downKey
leftKey
@Deprecated protected KeyStroke leftKey
rightKey
@Deprecated protected KeyStroke rightKey
Constructor Details
BasicToolBarUI
public BasicToolBarUI()
BasicToolBarUI
.Method Details
createUI
public static ComponentUI createUI(JComponent c)
BasicToolBarUI
.- Parameters:
-
c
- a component - Returns:
- a new instance of
BasicToolBarUI
installDefaults
protected void installDefaults()
uninstallDefaults
protected void uninstallDefaults()
installComponents
protected void installComponents()
uninstallComponents
protected void uninstallComponents()
installListeners
protected void installListeners()
uninstallListeners
protected void uninstallListeners()
installKeyboardActions
protected void installKeyboardActions()
uninstallKeyboardActions
protected void uninstallKeyboardActions()
createRolloverBorder
protected Border createRolloverBorder()
Override this method to provide an alternate rollover border.
- Returns:
- a rollover border for toolbar components
- Since:
- 1.4
createNonRolloverBorder
protected Border createNonRolloverBorder()
Override this method to provide an alternate rollover border.
- Returns:
- the non rollover border for toolbar components
- Since:
- 1.4
createFloatingFrame
@Deprecated(since="17") protected JFrame createFloatingFrame(JToolBar toolbar)
createFloatingWindow(JToolBar)
be used instead- Parameters:
-
toolbar
- an instance ofJToolBar
- Returns:
- an instance of
JFrame
- See Also:
createFloatingWindow
protected RootPaneContainer createFloatingWindow(JToolBar toolbar)
- Parameters:
-
toolbar
- an instance ofJToolBar
- Returns:
- a
RootPaneContainer
object, containing the toolbar - Since:
- 1.4
createDragWindow
protected BasicToolBarUI.DragWindow createDragWindow(JToolBar toolbar)
DragWindow
.- Parameters:
-
toolbar
- an instance ofJToolBar
- Returns:
- an instance of
DragWindow
isRolloverBorders
public boolean isRolloverBorders()
- Returns:
- true if rollover borders are enabled; false otherwise
- Since:
- 1.4
- See Also:
setRolloverBorders
public void setRolloverBorders(boolean rollover)
- Parameters:
-
rollover
- if true, rollover borders are installed. Otherwise non-rollover borders are installed - Since:
- 1.4
- See Also:
installRolloverBorders
protected void installRolloverBorders(JComponent c)
This is a convenience method to call setBorderToRollover
for each child component.
- Parameters:
-
c
- container which holds the child components (usually a JToolBar) - Since:
- 1.4
- See Also:
installNonRolloverBorders
protected void installNonRolloverBorders(JComponent c)
This is a convenience method to call setBorderToNonRollover
for each child component.
- Parameters:
-
c
- container which holds the child components (usually a JToolBar) - Since:
- 1.4
- See Also:
installNormalBorders
protected void installNormalBorders(JComponent c)
This is a convenience method to call setBorderNormal
for each child component.
- Parameters:
-
c
- container which holds the child components (usually a JToolBar) - Since:
- 1.4
- See Also:
setBorderToRollover
protected void setBorderToRollover(Component c)
createRolloverBorder()
method.- Parameters:
-
c
- component which will have a rollover border installed - Since:
- 1.4
- See Also:
getRolloverBorder
protected Border getRolloverBorder(AbstractButton b)
- Parameters:
-
b
- the button to calculate the rollover border for - Returns:
- the rollover border
- Since:
- 1.6
- See Also:
setBorderToNonRollover
protected void setBorderToNonRollover(Component c)
createNonRolloverBorder()
method.- Parameters:
-
c
- component which will have a non-rollover border installed - Since:
- 1.4
- See Also:
getNonRolloverBorder
protected Border getNonRolloverBorder(AbstractButton b)
- Parameters:
-
b
- the button to calculate the non-rollover border for - Returns:
- the non-rollover border
- Since:
- 1.6
- See Also:
setBorderToNormal
protected void setBorderToNormal(Component c)
- Parameters:
-
c
- component which will have a normal border re-installed - Since:
- 1.4
- See Also:
setFloatingLocation
public void setFloatingLocation(int x, int y)
- Parameters:
-
x
- an X coordinate -
y
- an Y coordinate
isFloating
public boolean isFloating()
true
if the JToolBar
is floating- Returns:
-
true
if theJToolBar
is floating
setFloating
public void setFloating(boolean b, Point p)
- Parameters:
-
b
-true
if theJToolBar
is floating -
p
- the position
setOrientation
public void setOrientation(int orientation)
- Parameters:
-
orientation
- the new orientation
getDockingColor
public Color getDockingColor()
- Returns:
- the color displayed when over a docking area
setDockingColor
public void setDockingColor(Color c)
- Parameters:
-
c
- the new color
getFloatingColor
public Color getFloatingColor()
- Returns:
- the color displayed when over a floating area
setFloatingColor
public void setFloatingColor(Color c)
- Parameters:
-
c
- the new color
canDock
public boolean canDock(Component c, Point p)
true
if the JToolBar
can dock at the given position.- Parameters:
-
c
- a component -
p
- a position - Returns:
-
true
if theJToolBar
can dock at the given position
dragTo
protected void dragTo(Point position, Point origin)
DragWindow
during the JToolBar
is being dragged.- Parameters:
-
position
- the relative to theJTollBar
position -
origin
- the screen position ofJToolBar
before dragging
floatAt
protected void floatAt(Point position, Point origin)
- Parameters:
-
position
- the relative to theJTollBar
position -
origin
- the screen position ofJToolBar
before dragging
createToolBarContListener
protected ContainerListener createToolBarContListener()
ContainerListener
.- Returns:
- an instance of
ContainerListener
createToolBarFocusListener
protected FocusListener createToolBarFocusListener()
FocusListener
.- Returns:
- an instance of
FocusListener
createPropertyListener
protected PropertyChangeListener createPropertyListener()
PropertyChangeListener
.- Returns:
- an instance of
PropertyChangeListener
createDockingListener
protected MouseInputListener createDockingListener()
MouseInputListener
.- Returns:
- an instance of
MouseInputListener
createFrameListener
protected WindowListener createFrameListener()
WindowListener
.- Returns:
- a new instance of
WindowListener
paintDragWindow
protected void paintDragWindow(Graphics g)
- Parameters:
-
g
- Graphics to paint to. - Throws:
-
NullPointerException
- isg
is null - Since:
- 1.5
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/plaf/basic/BasicToolBarUI.html