- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ToolBarUI
-
- javax.swing.plaf.basic.BasicToolBarUI
-
- javax.swing.plaf.synth.SynthToolBarUI
-
- All Implemented Interfaces:
-
PropertyChangeListener,EventListener,SynthConstants,SynthUI,SwingConstants
public class SynthToolBarUI extends BasicToolBarUI implements PropertyChangeListener, SynthUI
为JToolBar提供Synth L&F UI代表。- 从以下版本开始:
- 1.7
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.plaf.basic.BasicToolBarUI
BasicToolBarUI.DockingListener, BasicToolBarUI.DragWindow, BasicToolBarUI.FrameListener, BasicToolBarUI.PropertyListener, BasicToolBarUI.ToolBarContListener, BasicToolBarUI.ToolBarFocusListener
-
-
Field Summary
-
Fields inherited from class javax.swing.plaf.basic.BasicToolBarUI
constraintBeforeFloating, dockingBorderColor, dockingColor, dockingListener, downKey, dragWindow, floatingBorderColor, floatingColor, focusedCompIndex, leftKey, propertyListener, rightKey, toolBar, toolBarContListener, toolBarFocusListener, upKey
-
Fields inherited from 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
-
Fields inherited from interface javax.swing.plaf.synth.SynthConstants
DEFAULT, DISABLED, ENABLED, FOCUSED, MOUSE_OVER, PRESSED, SELECTED
-
-
构造方法摘要
构造方法 Constructor 描述 SynthToolBarUI()
-
方法摘要
所有方法 静态方法 接口方法 具体的方法 Modifier and Type 方法 描述 protected LayoutManagercreateLayout()创建一个LayoutManager与工具栏一起使用。static ComponentUIcreateUI(JComponent c)为给定的组件创建一个新的UI对象。SynthContextgetContext(JComponent c)返回指定组件的上下文。protected voidinstallComponents()注册组件。protected voidinstallDefaults()安装默认属性。protected voidinstallListeners()注册听众。voidpaint(Graphics g, JComponent c)根据外观和外观绘制指定的组件。protected voidpaint(SynthContext context, Graphics g)绘制工具栏。voidpaintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)画边框protected voidpaintContent(SynthContext context, Graphics g, Rectangle bounds)绘制工具栏内容。protected voidpaintDragWindow(Graphics g)绘制用于拖动的窗口的内容。voidpropertyChange(PropertyChangeEvent e)当绑定属性更改时,此方法将被调用。protected voidsetBorderToNonRollover(Component c)这个实现什么都不做,因为JToolBar类的rollover属性在Synth Look和Feel中没有使用。protected voidsetBorderToNormal(Component c)这个实现什么都不做,因为JToolBar类的rollover属性没有用在Synth Look and Feel中。protected voidsetBorderToRollover(Component c)这个实现什么都不做,因为JToolBar类的rollover属性没有用在Synth Look and Feel中。protected voiduninstallComponents()取消注册组件。protected voiduninstallDefaults()卸载默认属性。protected voiduninstallListeners()取消注册听众。voidupdate(Graphics g, JComponent c)通知此UI代理重新绘制指定的组件。-
Methods inherited from class javax.swing.plaf.basic.BasicToolBarUI
canDock, createDockingListener, createDragWindow, createFloatingFrame, createFloatingWindow, createFrameListener, createNonRolloverBorder, createPropertyListener, createRolloverBorder, createToolBarContListener, createToolBarFocusListener, dragTo, floatAt, getDockingColor, getFloatingColor, getNonRolloverBorder, getRolloverBorder, installKeyboardActions, installNonRolloverBorders, installNormalBorders, installRolloverBorders, installUI, isFloating, isRolloverBorders, navigateFocusedComp, setDockingColor, setFloating, setFloatingColor, setFloatingLocation, setOrientation, setRolloverBorders, uninstallKeyboardActions, uninstallUI
-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize
-
-
-
-
方法详细信息
-
createUI
public static ComponentUI createUI(JComponent c)
为给定的组件创建一个新的UI对象。- 参数
-
c- 为其创建UI对象的组件 - 结果
- UI对象
-
installDefaults
protected void installDefaults()
安装默认属性。
-
installListeners
protected void installListeners()
注册听众。
-
uninstallListeners
protected void uninstallListeners()
取消注册听众。
-
uninstallDefaults
protected void uninstallDefaults()
卸载默认属性。
-
installComponents
protected void installComponents()
注册组件。
-
uninstallComponents
protected void uninstallComponents()
取消注册组件。
-
createLayout
protected LayoutManager createLayout()
创建一个LayoutManager用于工具栏。- 结果
-
一个
LayoutManager实例
-
getContext
public SynthContext getContext(JComponent c)
返回指定组件的上下文。- Specified by:
-
getContext在接口SynthUI - 参数
-
c- 组件请求SynthContext。 - 结果
- SynthContext描述组件。
-
update
public void update(Graphics g, JComponent c)
通知此UI代理重新绘制指定的组件。 该方法描述了组件背景,然后调用了paint(SynthContext,Graphics)方法。通常,此方法不需要被子类覆盖。 所有Look和Feel渲染代码都应该在
paint方法中。- 重写:
-
update在ComponentUI - 参数
-
g- 用于绘画的Graphics对象 -
c- 正在涂漆的组件 - 另请参见:
-
paint(SynthContext,Graphics)
-
paint
public void paint(Graphics g, JComponent c)
根据外观和外观绘制指定的组件。Synth Look and Feel不使用此方法。 绘画由
paint(SynthContext,Graphics)处理。- 重写:
-
paint类ComponentUI - 参数
-
g- 用于绘画的Graphics对象 -
c- 正在涂漆的组件 - 另请参见:
-
paint(SynthContext,Graphics)
-
paintBorder
public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
画边框- Specified by:
-
paintBorder在接口SynthUI - 参数
-
context- 组件上下文 -
g-Graphics上画 -
x- X坐标 -
y- Y坐标 -
w- 边框的宽度 -
h- 边框的高度
-
setBorderToNonRollover
protected void setBorderToNonRollover(Component c)
这个实现什么都不做,因为JToolBar类的rollover属性没有用在Synth Look and Feel中。- 重写:
-
setBorderToNonRollover在BasicToolBarUI - 参数
-
c- 将安装非滚动边框的组件 - 另请参见:
-
BasicToolBarUI.createNonRolloverBorder()
-
setBorderToRollover
protected void setBorderToRollover(Component c)
这个实现什么都不做,因为JToolBar类的rollover属性没有在Synth Look和Feel中使用。- 重写:
-
setBorderToRollover在BasicToolBarUI - 参数
-
c- 将安装滚动边框的组件 - 另请参见:
-
BasicToolBarUI.createRolloverBorder()
-
setBorderToNormal
protected void setBorderToNormal(Component c)
这个实现什么都不做,因为JToolBar类的rollover属性在Synth Look和Feel中没有使用。- 重写:
-
setBorderToNormal在BasicToolBarUI - 参数
-
c- 将重新安装正常边框的组件 - 另请参见:
-
BasicToolBarUI.createNonRolloverBorder()
-
paint
protected void paint(SynthContext context, Graphics g)
绘制工具栏。- 参数
-
context- 正在绘制的组件的上下文 -
g- 用于绘画的Graphics对象 - 另请参见:
-
update(Graphics,JComponent)
-
paintContent
protected void paintContent(SynthContext context, Graphics g, Rectangle bounds)
绘制工具栏内容。- 参数
-
context- 正在绘制的组件的上下文 -
g-Graphics用于绘画的对象 -
bounds- 工具栏的边框
-
paintDragWindow
protected void paintDragWindow(Graphics g)
绘制用于拖动的窗口的内容。- 重写:
-
paintDragWindow在BasicToolBarUI - 参数
-
g- 绘制图形。
-
propertyChange
public void propertyChange(PropertyChangeEvent e)
当绑定属性更改时,此方法将被调用。- Specified by:
-
propertyChange在接口PropertyChangeListener - 参数
-
e- 描述事件源和已更改的属性的PropertyChangeEvent对象。
-
-