java.lang.Objectjavax.swing.plaf.ComponentUI
javax.swing.plaf.MenuBarUI
javax.swing.plaf.basic.BasicMenuBarUI
public class BasicMenuBarUI
MenuBarUI 的默认 L&F 实现。此实现是一个“组合的”视图/控制器。
| 字段摘要 | |
|---|---|
protected ChangeListener |
changeListener |
protected ContainerListener |
containerListener |
protected JMenuBar |
menuBar |
| 构造方法摘要 | |
|---|---|
BasicMenuBarUI() |
|
| 方法摘要 | |
|---|---|
protected ChangeListener |
createChangeListener() |
protected ContainerListener |
createContainerListener() |
static ComponentUI |
createUI(JComponent x) |
Dimension |
getMaximumSize(JComponent c) 返回指定组件的适合外观的最大大小。 |
Dimension |
getMinimumSize(JComponent c) 返回指定组件的适合外观的最小大小。 |
protected void |
installDefaults() |
protected void |
installKeyboardActions() |
protected void |
installListeners() |
void |
installUI(JComponent c) 配置指定组件,使其适合外观。 |
protected void |
uninstallDefaults() |
protected void |
uninstallKeyboardActions() |
protected void |
uninstallListeners() |
void |
uninstallUI(JComponent c) 在 installUI 期间,在指定组件上反向执行的配置操作。 |
| 从类 javax.swing.plaf.ComponentUI 继承的方法 |
|---|
contains, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getPreferredSize, paint, update |
| 从类 java.lang.Object 继承的方法 |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| 字段详细信息 |
|---|
protected JMenuBar menuBar
protected ContainerListener containerListener
protected ChangeListener changeListener
| 构造方法详细信息 |
|---|
public BasicMenuBarUI()
| 方法详细信息 |
|---|
public static ComponentUI createUI(JComponent x)
public void installUI(JComponent c)
ComponentUI 复制的描述
ComponentUI 实例将作为 UI 委托安装在指定组件上时,可调用此方法。此方法应该为外观完整地配置组件,包括以下方面:
LayoutManager。 PropertyChangeListener。
ComponentUI 中的
installUI
c - 将安装此 UI 委托的组件
ComponentUI.uninstallUI(javax.swing.JComponent),
JComponent.setUI(javax.swing.plaf.ComponentUI),
JComponent.updateUI()
protected void installDefaults()
protected void installListeners()
protected void installKeyboardActions()
public void uninstallUI(JComponent c)
ComponentUI 复制的描述
installUI 期间,在指定组件上反向执行的配置操作。当此
UIComponent 实例将作为 UI 委托从指定组件上移除时,可调用此方法。此方法应该取消在
installUI 中执行的配置操作,非常小心地使
JComponent 实例处于某种洁净状态(没有额外的侦听器、没有特定于外观的属性对象等等)。配置内容应该包括以下方面:
ComponentUI 中的
uninstallUI
c - 从中移除此 UI 委托的组件;此参数常被忽略,但如果 UI 对象是无状态的并由多个组件共享,则可以使用该参数
ComponentUI.installUI(javax.swing.JComponent),
JComponent.updateUI()
protected void uninstallDefaults()
protected void uninstallListeners()
protected void uninstallKeyboardActions()
protected ContainerListener createContainerListener()
protected ChangeListener createChangeListener()
public Dimension getMinimumSize(JComponent c)
ComponentUI 复制的描述
null,则最小大小将由组件的布局管理器计算(对于安装了特定布局管理器的组件而言,这是首选方法)。此方法的默认实现调用
getPreferredSize 并返回该值。
ComponentUI 中的
getMinimumSize
c - 将查询其最小大小的组件;此参数常被忽略,但如果 UI 对象是无状态的并由多个组件共享,则可以使用该参数
Dimension 对象或
null
JComponent.getMinimumSize(),
LayoutManager.minimumLayoutSize(java.awt.Container),
ComponentUI.getPreferredSize(javax.swing.JComponent)
public Dimension getMaximumSize(JComponent c)
ComponentUI 复制的描述
null,则最大大小将由组件的布局管理器计算(对于安装了特定布局管理器的组件而言,这是首选方法)。此方法的默认实现调用
getPreferredSize 并返回该值。
ComponentUI 中的
getMaximumSize
c - 将查询其最大大小的组件;此参数常被忽略,但如果 UI 对象是无状态的并由多个组件共享,则可以使用该参数
Dimension 对象或
null
JComponent.getMaximumSize(),
LayoutManager2.maximumLayoutSize(java.awt.Container)