public class SynthMenuItemUI extends BasicMenuItemUI implements PropertyChangeListener, SynthUI
BasicMenuItemUI.MouseInputHandler
acceleratorDelimiter,
acceleratorFont,
acceleratorForeground,
acceleratorSelectionForeground,
arrowIcon,
checkIcon,
defaultTextIconGap,
disabledForeground,
menuDragMouseListener,
menuItem,
menuKeyListener,
mouseInputListener,
oldBorderPainted,
propertyChangeListener,
selectionBackground,
selectionForeground
DEFAULT,
DISABLED,
ENABLED,
FOCUSED,
MOUSE_OVER,
PRESSED,
SELECTED
Constructor and Description |
---|
SynthMenuItemUI()
|
Modifier and Type | Method and Description |
---|---|
static ComponentUI |
createUI(JComponent c)
为给定的组件创建一个新的UI对象。
|
SynthContext |
getContext(JComponent c)
返回指定组件的上下文。
|
protected Dimension
|
getPreferredMenuItemSize(JComponent c,
Icon checkIcon, Icon arrowIcon,
int defaultTextIconGap) |
protected void |
installDefaults()
|
protected void |
installListeners()
|
void |
paint(Graphics g,
JComponent c)
根据外观和外观绘制指定的组件。
|
protected void |
paint(SynthContext context, Graphics g)
绘制指定的组件。
|
void |
paintBorder(SynthContext context, Graphics g,
int x, int y, int w, int h)
画边框
|
void |
propertyChange(PropertyChangeEvent e)
当绑定属性更改时,此方法将被调用。
|
protected void |
uninstallDefaults()
|
protected void |
uninstallListeners()
|
void |
uninstallUI(JComponent c)
在installUI中反转在
installUI 上完成的
installUI 。
|
void |
update(Graphics g,
JComponent c)
通知此UI代理重新绘制指定的组件。
|
createMenuDragMouseListener,
createMenuKeyListener,
createMouseInputListener,
createPropertyChangeListener,
doClick,
getMaximumSize,
getMinimumSize,
getPath,
getPreferredSize,
getPropertyPrefix,
installComponents,
installKeyboardActions,
installUI,
paintBackground,
paintMenuItem,
paintText,
uninstallComponents,
uninstallKeyboardActions
contains,
getAccessibleChild,
getAccessibleChildrenCount,
getBaseline,
getBaselineResizeBehavior
public static ComponentUI createUI(JComponent c)
c
- 创建UI对象的组件
public void uninstallUI(JComponent c)
installUI
上完成的installUI
。
当该UIComponent
实例作为指定组件的UI委托被删除时,将调用此方法。
该方法应该撤消在installUI中执行的installUI
,小心使JComponent
实例处于干净状态(无外部侦听器,外观特定属性对象等)。
这应该包括以下内容:
uninstallUI
在
BasicMenuItemUI
类
c
- 正在删除此UI代理的组件;
这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用
ComponentUI.installUI(javax.swing.JComponent)
,
JComponent.updateUI()
protected void installDefaults()
protected void installListeners()
protected void uninstallDefaults()
protected void uninstallListeners()
public SynthContext getContext(JComponent c)
getContext
在接口
SynthUI
c
- 组件请求SynthContext。
protected Dimension getPreferredMenuItemSize(JComponent c, Icon checkIcon, Icon arrowIcon, int defaultTextIconGap)
public void update(Graphics g, JComponent c)
paint(SynthContext,Graphics)
方法。
通常,此方法不需要被子类覆盖。
所有Look和Feel渲染代码应该在paint
方法中。
update
在
BasicMenuItemUI
g
- 用于绘画的
Graphics
对象
c
- 正在涂漆的组件
paint(SynthContext,Graphics)
public void paint(Graphics g, JComponent c)
Synth Look and Feel不使用此方法。 绘画由paint(SynthContext,Graphics)
处理。
paint
在
BasicMenuItemUI
g
- 用于绘画的
Graphics
对象
c
- 被绘的部件
paint(SynthContext,Graphics)
protected void paint(SynthContext context, Graphics g)
context
- 正在绘制的组件的上下文
g
- 用于绘画的
Graphics
对象
update(Graphics,JComponent)
public void paintBorder(SynthContext context, Graphics g, int x, int y, int w, int h)
paintBorder
在接口
SynthUI
context
- 组件上下文
g
-
Graphics
上画
x
- X坐标
y
- Y坐标
w
- 边框的宽度
h
- 边框的高度
public void propertyChange(PropertyChangeEvent e)
propertyChange
在界面
PropertyChangeListener
e
- 描述事件源和已更改的属性的PropertyChangeEvent对象。