- java.lang.Object
-
- java.awt.Component
-
- java.awt.Container
-
- javax.swing.JComponent
-
- javax.swing.AbstractButton
-
- javax.swing.JButton
-
- javax.swing.plaf.metal.MetalComboBoxButton
-
- All Implemented Interfaces:
-
ImageObserver
,ItemSelectable
,MenuContainer
,Serializable
,Accessible
,SwingConstants
public class MetalComboBoxButton extends JButton
JButton子类来帮助MetalComboBoxUI警告:此类的序列化对象与将来的Swing版本不兼容。 当前的序列化支持适用于运行相同版本的Swing的应用程序之间的短期存储或RMI。 从1.4开始,所有JavaBeans的长期存储支持已被添加到
java.beans
软件包中。 请参阅XMLEncoder
。- 另请参见:
-
MetalComboBoxButton
, Serialized Form
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class javax.swing.AbstractButton
AbstractButton.AccessibleAbstractButton, AbstractButton.ButtonChangeListener
-
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
-
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
-
Nested classes/interfaces inherited from class javax.swing.JButton
JButton.AccessibleJButton
-
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
-
-
Field Summary
Fields Modifier and Type Field 描述 protected JComboBox<Object>
comboBox
实例JComboBox
。protected Icon
comboIcon
图标。protected boolean
iconOnly
价值iconOnly
。protected JList<Object>
listBox
实例JList
。protected CellRendererPane
rendererPane
实例CellRendererPane
。-
Fields inherited from class javax.swing.AbstractButton
actionListener, BORDER_PAINTED_CHANGED_PROPERTY, changeEvent, changeListener, CONTENT_AREA_FILLED_CHANGED_PROPERTY, DISABLED_ICON_CHANGED_PROPERTY, DISABLED_SELECTED_ICON_CHANGED_PROPERTY, FOCUS_PAINTED_CHANGED_PROPERTY, HORIZONTAL_ALIGNMENT_CHANGED_PROPERTY, HORIZONTAL_TEXT_POSITION_CHANGED_PROPERTY, ICON_CHANGED_PROPERTY, itemListener, MARGIN_CHANGED_PROPERTY, MNEMONIC_CHANGED_PROPERTY, model, MODEL_CHANGED_PROPERTY, PRESSED_ICON_CHANGED_PROPERTY, ROLLOVER_ENABLED_CHANGED_PROPERTY, ROLLOVER_ICON_CHANGED_PROPERTY, ROLLOVER_SELECTED_ICON_CHANGED_PROPERTY, SELECTED_ICON_CHANGED_PROPERTY, TEXT_CHANGED_PROPERTY, VERTICAL_ALIGNMENT_CHANGED_PROPERTY, VERTICAL_TEXT_POSITION_CHANGED_PROPERTY
-
Fields inherited from class java.awt.Component
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
-
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
-
Fields inherited from class javax.swing.JComponent
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
-
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
-
-
构造方法摘要
构造方法 Constructor 描述 MetalComboBoxButton(JComboBox<Object> cb, Icon i, boolean onlyIcon, CellRendererPane pane, JList<Object> list)
构造一个新的实例MetalComboBoxButton
。MetalComboBoxButton(JComboBox<Object> cb, Icon i, CellRendererPane pane, JList<Object> list)
构造一个新的实例MetalComboBoxButton
。
-
方法摘要
所有方法 接口方法 具体的方法 Modifier and Type 方法 描述 JComboBox<Object>
getComboBox()
返回JComboBox
。Icon
getComboIcon()
返回JComboBox
的图标。Dimension
getMinimumSize()
如果最小尺寸设置为非null
值,则返回。boolean
isFocusTraversable()
返回这个Component
是否可以成为焦点所有者。boolean
isIconOnly()
返回isIconOnly
值。void
paintComponent(Graphics g)
调用UInull
的paint方法,如果UInull
。void
setComboBox(JComboBox<Object> cb)
设置JComboBox
。void
setComboIcon(Icon i)
设置JComboBox
的图标。void
setEnabled(boolean enabled)
启用(或禁用)按钮。void
setIconOnly(boolean isIconOnly)
如果isIconOnly
是true
那么只有图标被画。-
Methods inherited from class javax.swing.AbstractButton
actionPropertyChanged, addActionListener, addChangeListener, addImpl, addItemListener, checkHorizontalKey, checkVerticalKey, configurePropertiesFromAction, createActionListener, createActionPropertyChangeListener, createChangeListener, createItemListener, doClick, doClick, fireActionPerformed, fireItemStateChanged, fireStateChanged, getAction, getActionCommand, getActionListeners, getChangeListeners, getDisabledIcon, getDisabledSelectedIcon, getDisplayedMnemonicIndex, getHideActionText, getHorizontalAlignment, getHorizontalTextPosition, getIcon, getIconTextGap, getItemListeners, getLabel, getMargin, getMnemonic, getModel, getMultiClickThreshhold, getPressedIcon, getRolloverIcon, getRolloverSelectedIcon, getSelectedIcon, getSelectedObjects, getText, getUI, getVerticalAlignment, getVerticalTextPosition, imageUpdate, init, isBorderPainted, isContentAreaFilled, isFocusPainted, isRolloverEnabled, isSelected, paintBorder, removeActionListener, removeChangeListener, removeItemListener, setAction, setActionCommand, setBorderPainted, setContentAreaFilled, setDisabledIcon, setDisabledSelectedIcon, setDisplayedMnemonicIndex, setFocusPainted, setHideActionText, setHorizontalAlignment, setHorizontalTextPosition, setIcon, setIconTextGap, setLabel, setLayout, setMargin, setMnemonic, setMnemonic, setModel, setMultiClickThreshhold, setPressedIcon, setRolloverEnabled, setRolloverIcon, setRolloverSelectedIcon, setSelected, setSelectedIcon, setText, setUI, setVerticalAlignment, setVerticalTextPosition
-
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, requestFocus, requestFocus, requestFocusInWindow, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setMixingCutoutShape, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
-
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, transferFocusDownCycle, validate, validateTree
-
Methods inherited from class javax.swing.JButton
getAccessibleContext, getUIClassID, isDefaultButton, isDefaultCapable, paramString, removeNotify, setDefaultCapable, updateUI
-
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
-
-
-
-
方法详细信息
-
getComboIcon
public final Icon getComboIcon()
返回JComboBox
的图标。- 结果
-
JComboBox
的图标
-
setComboIcon
public final void setComboIcon(Icon i)
设置JComboBox
的图标。- 参数
-
i
-的图标JComboBox
-
isIconOnly
public final boolean isIconOnly()
返回isIconOnly
值。- 结果
-
isIconOnly
价值
-
setIconOnly
public final void setIconOnly(boolean isIconOnly)
如果isIconOnly
是true
那么只有图标被画。- 参数
-
isIconOnly
- 如果true
然后只有图标被画
-
isFocusTraversable
public boolean isFocusTraversable()
描述从类别复制:Component
返回这个Component
是否可以成为焦点所有者。- 重写:
-
isFocusTraversable
在Component
- 结果
-
true
如果这个Component
是可Component
的; 否则为false
- 另请参见:
-
Component.setFocusable(boolean)
-
setEnabled
public void setEnabled(boolean enabled)
描述从类别复制:AbstractButton
启用(或禁用)按钮。- 重写:
-
setEnabled
的AbstractButton
- 参数
-
enabled
- true启用按钮,否则为false - 另请参见:
-
Component.isEnabled()
,Component.isLightweight()
-
paintComponent
public void paintComponent(Graphics g)
描述从类别复制:JComponent
调用UI委托的paint方法,如果UInull
。 我们通过委托一份Graphics
对象的副本,以保护其余的油漆代码免受不可撤销的更改(例如,Graphics.translate
)。如果你在一个子类中重写这个,那么你不应该对
Graphics
的传递进行永久的更改。 例如,您不应该更改剪辑Rectangle
或修改转换。 如果您需要执行这些操作,您可能会发现从Graphics
中传递的操作更容易创建一个新的Graphics
并进行操作。 此外,如果您不调用super的实现,则必须遵守不透明属性,即如果此组件不透明,则必须以非不透明颜色完全填写背景。 如果您不遵守不透明属性,您将可能会看到视觉工件。在
Graphics
对象中传递的对象可能具有除了安装在其上的标识变换之外的变换。 在这种情况下,如果累积应用另一个变换,您可能会得到意想不到的结果。- 重写:
-
paintComponent
在JComponent
- 参数
-
g
-Graphics
对象保护 - 另请参见:
-
JComponent.paint(java.awt.Graphics)
,ComponentUI
-
getMinimumSize
public Dimension getMinimumSize()
说明从类别复制:JComponent
如果最小尺寸设置为非null
值,则返回。 如果UI代表的getMinimumSize
方法返回一个非null
值,那么返回那个; 否则推迟到组件的布局管理器。- 重写:
-
getMinimumSize
在JComponent
- 结果
-
该值为
minimumSize
属性 - 另请参见:
-
JComponent.setMinimumSize(java.awt.Dimension)
,ComponentUI
-
-