JavaTM Platform
Standard Ed. 6

javax.swing.plaf.metal
类 MetalComboBoxUI

java.lang.Object
  继承者 javax.swing.plaf.ComponentUI
      继承者 javax.swing.plaf.ComboBoxUI
          继承者 javax.swing.plaf.basic.BasicComboBoxUI
              继承者 javax.swing.plaf.metal.MetalComboBoxUI

public class MetalComboBoxUI
     
extends BasicComboBoxUI

JComboBox 的 Metal UI

警告:此类的已序列化对象与以后的 Swing 版本不兼容。当前序列化支持适用于短期存储或运行相同 Swing 版本的应用程序之间的 RMI。从 1.4 版本开始,已在 java.beans 包中添加了支持所有 JavaBeansTM 长期存储的功能。请参见 XMLEncoder

另请参见:
MetalComboBoxEditor, MetalComboBoxButton

嵌套类摘要
 class MetalComboBoxUI.MetalComboBoxLayoutManager
          此内部类因编译器故障而被标记为 "public"。
 class MetalComboBoxUI.MetalComboPopup
          已过时。 从 Java 2 platform v1.4 开始。
 class MetalComboBoxUI.MetalPropertyChangeListener
          此内部类由于编译器故障而被标记为 "public"。
 
从类 javax.swing.plaf.basic.BasicComboBoxUI 继承的嵌套类/接口
BasicComboBoxUI.ComboBoxLayoutManager, BasicComboBoxUI.FocusHandler, BasicComboBoxUI.ItemHandler, BasicComboBoxUI.KeyHandler, BasicComboBoxUI.ListDataHandler, BasicComboBoxUI.PropertyChangeHandler
 
字段摘要
 
从类 javax.swing.plaf.basic.BasicComboBoxUI 继承的字段
arrowButton, cachedMinimumSize, comboBox, currentValuePane, editor, focusListener, hasFocus, isMinimumSizeDirty, itemListener, keyListener, listBox, listDataListener, popup, popupKeyListener, popupMouseListener, popupMouseMotionListener, propertyChangeListener
 
构造方法摘要
MetalComboBoxUI()
           
 
方法摘要
 void configureEditor()
          此受保护方法是特定于实现的,应该为私有,不要调用或重写。
protected  JButton createArrowButton()
          创建一个按钮,将使用它来控制显示或隐藏组合框的弹出部分。
protected  ComboBoxEditor createEditor()
          创建将在可编辑的组合框中使用的默认编辑器。
protected  LayoutManager createLayoutManager()
          创建用于管理构成组合框的组件的布局管理器。
protected  ComboPopup createPopup()
          创建组合框的弹出部分。
 PropertyChangeListener createPropertyChangeListener()
          创建将添加到组合框的 PropertyChangeListener
static ComponentUI createUI(JComponent c)
           
protected  void editablePropertyChanged(PropertyChangeEvent e)
          已过时。 从 Java 2 platform v1.4 开始。
 int getBaseline(JComponent c, int width, int height)
          返回基线。
 Dimension getMinimumSize(JComponent c)
          最小大小为显示区域加上 insets 再加上按钮的大小。
 void layoutComboBox(Container parent, MetalComboBoxUI.MetalComboBoxLayoutManager manager)
           
 void paint(Graphics g, JComponent c)
          绘制指定组件,使其适合外观。
 void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
          如有必要,绘制当前所选项。
 void paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus)
          如有必要,绘制当前所选项的背景。
protected  void removeListeners()
          已过时。 从 Java 2 platform v1.4 开始。
 void unconfigureEditor()
          此受保护方法是特定于实现的,应该为私有。
 
从类 javax.swing.plaf.basic.BasicComboBoxUI 继承的方法
addEditor, configureArrowButton, createFocusListener, createItemListener, createKeyListener, createListDataListener, createRenderer, getAccessibleChild, getAccessibleChildrenCount, getBaselineResizeBehavior, getDefaultSize, getDisplaySize, getInsets, getMaximumSize, getPreferredSize, installComponents, installDefaults, installKeyboardActions, installListeners, installUI, isFocusTraversable, isNavigationKey, isPopupVisible, rectangleForCurrentValue, removeEditor, selectNextPossibleValue, selectPreviousPossibleValue, setPopupVisible, toggleOpenClose, unconfigureArrowButton, uninstallComponents, uninstallDefaults, uninstallKeyboardActions, uninstallListeners, uninstallUI
 
从类 javax.swing.plaf.ComponentUI 继承的方法
contains, update
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

MetalComboBoxUI

public MetalComboBoxUI()
方法详细信息

createUI

public static ComponentUI createUI(JComponent c)

paint

public void paint(Graphics g,
                  JComponent c)
从类 ComponentUI 复制的描述
绘制指定组件,使其适合外观。在将要绘制指定组件时,从 ComponentUI.update 方法中调用此方法。子类应该重写此方法并使用指定 Graphics 对象来呈现组件的内容。

覆盖:
BasicComboBoxUI 中的 paint
参数:
g - 将在其中进行绘制的 Graphics 上下文
c - 将绘制的组件;此参数常被忽略,但如果 UI 对象是无状态的并由多个组件共享,则可以使用该参数
另请参见:
ComponentUI.update(java.awt.Graphics, javax.swing.JComponent)

paintCurrentValue

public void paintCurrentValue(Graphics g,
                              Rectangle bounds,
                              boolean hasFocus)
如有必要,绘制当前所选项。

覆盖:
BasicComboBoxUI 中的 paintCurrentValue
参数:
g - 作为绘制目标的 Graphic
bounds - 当前值的绘制范围
hasFocus - JComboBox 是否拥有焦点
抛出:
NullPointerException - 如果所有参数均为 null。
从以下版本开始:
1.5

paintCurrentValueBackground

public void paintCurrentValueBackground(Graphics g,
                                        Rectangle bounds,
                                        boolean hasFocus)
如有必要,绘制当前所选项的背景。

覆盖:
BasicComboBoxUI 中的 paintCurrentValueBackground
参数:
g - 作为绘制目标的 Graphic
bounds - 背景的绘制范围
hasFocus - JComboBox 是否拥有焦点
抛出:
NullPointerException - 如果所有参数均为 null。
从以下版本开始:
1.5

getBaseline

public int getBaseline(JComponent c,
                       int width,
                       int height)
返回基线。

覆盖:
BasicComboBoxUI 中的 getBaseline
参数:
c - 为其请求基线的 JComponent
width - 为其获取基线的宽度
height - 为其获取基线的高度
返回:
基线;如果没有合理的基线,则返回 < 0 的值
抛出:
NullPointerException - 如果 cnull
IllegalArgumentException - 如果宽度或高度 < 0
从以下版本开始:
1.6
另请参见:
JComponent.getBaseline(int, int)

createEditor

protected ComboBoxEditor createEditor()
从类 BasicComboBoxUI 复制的描述
创建将在可编辑的组合框中使用的默认编辑器。仅当没有利用 setEditor 显式设置编辑器时才使用默认编辑器。

覆盖:
BasicComboBoxUI 中的 createEditor
返回:
用于组合框的 ComboBoxEditor
另请参见:
JComboBox.setEditor(javax.swing.ComboBoxEditor)

createPopup

protected ComboPopup createPopup()
从类 BasicComboBoxUI 复制的描述
创建组合框的弹出部分。

覆盖:
BasicComboBoxUI 中的 createPopup
返回:
ComboPopup 的实例
另请参见:
ComboPopup

createArrowButton

protected JButton createArrowButton()
从类 BasicComboBoxUI 复制的描述
创建一个按钮,将使用它来控制显示或隐藏组合框的弹出部分。

覆盖:
BasicComboBoxUI 中的 createArrowButton
返回:
表示弹出控件的按钮

createPropertyChangeListener

public PropertyChangeListener createPropertyChangeListener()
从类 BasicComboBoxUI 复制的描述
创建将添加到组合框的 PropertyChangeListener。如果此方法返回 null,则不会将其添加到组合框。

覆盖:
BasicComboBoxUI 中的 createPropertyChangeListener
返回:
PropertyChangeListener 的实例或 null

editablePropertyChanged

@Deprecated
protected void editablePropertyChanged(PropertyChangeEvent e)
已过时。  从 Java 2 platform v1.4 开始。

从 Java 2 platform v1.4 开始,此方法不再使用。不要调用或重写此方法。此方法的所有功能都在 MetalPropertyChangeListener 中。


createLayoutManager

protected LayoutManager createLayoutManager()
从类 BasicComboBoxUI 复制的描述
创建用于管理构成组合框的组件的布局管理器。

覆盖:
BasicComboBoxUI 中的 createLayoutManager
返回:
布局管理器的实例

layoutComboBox

public void layoutComboBox(Container parent,
                           MetalComboBoxUI.MetalComboBoxLayoutManager manager)

removeListeners

@Deprecated
protected void removeListeners()
已过时。  从 Java 2 platform v1.4 开始。

从 Java 2 platform v1.4 开始,此方法不再使用。


configureEditor

public void configureEditor()
从类 BasicComboBoxUI 复制的描述
此受保护方法是特定于实现的,应该为私有,不要调用或重写。

覆盖:
BasicComboBoxUI 中的 configureEditor
另请参见:
BasicComboBoxUI.addEditor()

unconfigureEditor

public void unconfigureEditor()
从类 BasicComboBoxUI 复制的描述
此受保护方法是特定于实现的,应该为私有。不要调用或重写。

覆盖:
BasicComboBoxUI 中的 unconfigureEditor
另请参见:
BasicComboBoxUI.addEditor()

getMinimumSize

public Dimension getMinimumSize(JComponent c)
从类 BasicComboBoxUI 复制的描述
最小大小为显示区域加上 insets 再加上按钮的大小。

覆盖:
BasicComboBoxUI 中的 getMinimumSize
参数:
c - 将查询其最小大小的组件;此参数常被忽略,但如果 UI 对象是无状态的并由多个组件共享,则可以使用该参数
返回:
一个 Dimension 对象或 null
另请参见:
JComponent.getMinimumSize(), LayoutManager.minimumLayoutSize(java.awt.Container), ComponentUI.getPreferredSize(javax.swing.JComponent)

JavaTM Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2007 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策