public class MetalComboBoxUI extends BasicComboBoxUI
警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。
从1.4开始,对所有JavaBeans的长期存储的支持已经添加到java.beans
包中。 请参阅XMLEncoder
。
Modifier and Type | Class and Description |
---|---|
class |
MetalComboBoxUI.MetalComboBoxLayoutManager
这个类应该被视为一个“受保护”的内部类。
|
class |
MetalComboBoxUI.MetalComboPopup
已弃用
从Java 2平台v1.4开始。
|
class |
MetalComboBoxUI.MetalPropertyChangeListener
这个类应该被视为一个“受保护”的内部类。
|
BasicComboBoxUI.ComboBoxLayoutManager,
BasicComboBoxUI.FocusHandler, BasicComboBoxUI.ItemHandler, BasicComboBoxUI.KeyHandler, BasicComboBoxUI.ListDataHandler,
BasicComboBoxUI.PropertyChangeHandler
arrowButton,
cachedMinimumSize,
comboBox,
currentValuePane,
editor,
focusListener,
hasFocus,
isMinimumSizeDirty,
itemListener,
keyListener,
listBox,
listDataListener,
padding,
popup,
popupKeyListener,
popupMouseListener,
popupMouseMotionListener,
propertyChangeListener,
squareButton
Constructor and Description |
---|
MetalComboBoxUI()
|
Modifier and Type | Method and Description |
---|---|
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平台v1.4开始。
|
int |
getBaseline(JComponent c,
int width, int height)
返回基线。
|
Dimension |
getMinimumSize(JComponent c)
最小尺寸是显示区域的大小加上插页加上按钮。
|
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平台v1.4开始。
|
void |
unconfigureEditor()
此受保护方法是实现特定的,应该是私有的。
|
addEditor,
configureArrowButton,
createFocusListener,
createItemListener,
createKeyListener,
createListDataListener,
createRenderer,
getAccessibleChild,
getAccessibleChildrenCount,
getBaselineResizeBehavior,
getDefaultSize,
getDisplaySize,
getInsets,
getMaximumSize,
getPreferredSize,
getSizeForComponent,
installComponents,
installDefaults,
installKeyboardActions,
installListeners,
installUI,
isFocusTraversable,
isNavigationKey,
isPopupVisible,
rectangleForCurrentValue,
removeEditor,
selectNextPossibleValue,
selectPreviousPossibleValue,
setPopupVisible,
toggleOpenClose,
unconfigureArrowButton,
uninstallComponents,
uninstallDefaults,
uninstallKeyboardActions,
uninstallListeners,
uninstallUI
contains,
update
public static ComponentUI createUI(JComponent c)
public void paint(Graphics g, JComponent c)
ComponentUI
ComponentUI.update
指定组件正在被绘制时的方法。
子类应该覆盖此方法,并使用指定的Graphics
对象来呈现Graphics
的内容。
paint
在
BasicComboBoxUI
g
- 要绘画的
Graphics
上下文
c
- 被涂的部件
这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用
ComponentUI.update(java.awt.Graphics,
javax.swing.JComponent)
public void paintCurrentValue(Graphics g, Rectangle bounds, boolean hasFocus)
paintCurrentValue
在
BasicComboBoxUI
g
- 绘图的图形
bounds
- 绘制当前值的区域
hasFocus
-
hasFocus
是否有焦点
NullPointerException
- 如果任何参数为空。
public void paintCurrentValueBackground(Graphics g, Rectangle bounds, boolean hasFocus)
paintCurrentValueBackground
在
BasicComboBoxUI
g
- 绘图的图形
bounds
- 绘制背景的区域
hasFocus
- 是否JComboBox有焦点
NullPointerException
- 如果任何参数为空。
public int getBaseline(JComponent c, int width, int height)
getBaseline
在
BasicComboBoxUI
c
-
JComponent
正在请求基准
width
- 获取基准的宽度
height
- 获取基准的高度
NullPointerException
- 如果
c
是
null
IllegalArgumentException
-
如果宽度或高度<0
JComponent.getBaseline(int,
int)
protected ComboBoxEditor createEditor()
BasicComboBoxUI
setEditor
进行显式设置时, setEditor
使用默认编辑器。
createEditor
在
BasicComboBoxUI
ComboBoxEditor
用于组合框
JComboBox.setEditor(javax.swing.ComboBoxEditor)
protected ComboPopup createPopup()
BasicComboBoxUI
createPopup
在
BasicComboBoxUI
ComboPopup
ComboPopup
protected JButton createArrowButton()
BasicComboBoxUI
createArrowButton
在类
BasicComboBoxUI
public PropertyChangeListener createPropertyChangeListener()
BasicComboBoxUI
PropertyChangeListener
,它将被添加到组合框中。
如果此方法返回null,则不会将其添加到组合框中。
createPropertyChangeListener
在
BasicComboBoxUI
PropertyChangeListener
或null的实例
@Deprecated protected void editablePropertyChanged(PropertyChangeEvent e)
protected LayoutManager createLayoutManager()
BasicComboBoxUI
createLayoutManager
在
BasicComboBoxUI
类
public void layoutComboBox(Container parent, MetalComboBoxUI.MetalComboBoxLayoutManager manager)
@Deprecated protected void removeListeners()
public void configureEditor()
BasicComboBoxUI
public void unconfigureEditor()
BasicComboBoxUI
public Dimension getMinimumSize(JComponent c)
BasicComboBoxUI
getMinimumSize
在
BasicComboBoxUI
c
- 查询最小大小的组件;
这个参数经常被忽略,但如果UI对象是无状态的并且被多个组件共享,则可能会被使用
Dimension
对象或
null
JComponent.getMinimumSize()
,
LayoutManager.minimumLayoutSize(java.awt.Container)
,
ComponentUI.getPreferredSize(javax.swing.JComponent)