java.lang.Object
java.awt.Component
java.awt.Container
javax.swing.JComponent
javax.swing.JPopupMenu
javax.swing.plaf.basic.BasicComboPopup
- 所有已实现的接口:
ImageObserver,MenuContainer,Serializable,Accessible,MenuElement,ComboPopup
这是
ComboPopup 接口的基本实现。此类表示组合框弹出部分的用户界面。
所有事件处理都由使用createxxxListener() 方法和内部类创建的监听器类处理。您可以通过覆盖 createxxxListener() 方法并提供您自己的事件监听器或从此类中提供的事件监听器进行子类化来更改此类的行为。
Warning: 此类的序列化对象将与未来的 Swing 版本不兼容。当前的序列化支持适用于运行相同版本 Swing 的应用程序之间的短期存储或 RMI。从 1.4 开始,对所有 JavaBeans 的长期存储的支持已添加到 java.beans 包中。请参阅 XMLEncoder 。
-
内部类总结
内部类修饰符和类型类描述class从 Java 2 平台 v 1.4 开始,这个类现在已经过时,并且只是为了向后的 API 兼容性而被包含在内。protected class在组合框(not 其弹出菜单)上注册一个监听器,以处理影响弹出菜单状态的鼠标事件。protected class此监听监视拖动并更新列表中的当前选择(如果它正在列表上拖动)。protected class该监听监视组合框中选择的更改。class从 1.4 开始,这个类现在已经过时,不做任何事情,并且只是为了向后的 API 兼容性而被包含在内。protected class当鼠标在列表中被释放时,此监听隐藏弹出窗口。protected class当您将鼠标移到列表上时,此监听会更改所选项目。protected class从 Java 2 平台 v 1.4 开始,这个类现在已经过时,不做任何事情,并且只是为了向后的 API 兼容性而被包含在内。protected class此监听监视组合框中已更改的绑定属性。在类 javax.swing.JPopupMenu 中声明的嵌套类/接口
JPopupMenu.AccessibleJPopupMenu, JPopupMenu.Separator在类 javax.swing.JComponent 中声明的嵌套类/接口
JComponent.AccessibleJComponent在类 java.awt.Container 中声明的嵌套类/接口
Container.AccessibleAWTContainer -
字段摘要
字段修饰符和类型Field描述protected Timer该受保护字段是特定于实现的。JComboBox的实例。protected booleantrue如果鼠标光标在弹出窗口中。protected boolean如果true启用自动滚动。protected ItemListener该受保护字段是特定于实现的。protected KeyListener该受保护字段是特定于实现的。该受保护字段是特定于实现的。protected ListDataListener该受保护字段是特定于实现的。protected MouseListener该受保护字段是特定于实现的。protected MouseMotionListener该受保护字段是特定于实现的。protected ListSelectionListener该受保护字段是特定于实现的。protected MouseListener该受保护字段是特定于实现的。protected MouseMotionListener该受保护字段是特定于实现的。protected PropertyChangeListener该受保护字段是特定于实现的。protected static final int向下滚动的方向。protected static final int向上滚动的方向。protected int滚动的方向。protected JScrollPane该受保护字段是特定于实现的。protected boolean从 Java 2 平台 v1.4 开始,不再使用这个以前未记录的字段。在类 javax.swing.JComponent 中声明的字段
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW在类 java.awt.Component 中声明的字段
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT在接口 java.awt.image.ImageObserver 中声明的字段
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH -
构造方法总结
构造方法 -
方法总结
修饰符和类型方法描述protected void这个受保护的方法是特定于实现的,应该是私有的。protected void这个受保护的方法是特定于实现的,应该是私有的。protected RectanglecomputePopupBounds(int px, int py, int pw, int ph) 位置和封闭屏幕边界计算组合框弹出部分的位置和大小。protected void配置用于在弹出窗口中保存组合框项目的列表。protected void配置组合框的弹出部分。protected void配置在组合框弹出窗口中保存列表的可滚动部分。protected MouseEvent转换鼠标事件。protected ItemListener创建将添加到组合框的ItemListener。protected KeyListener创建将添加到组合框的键监听。创建弹出窗口中使用的 JList 以显示组合框模型中的项目。protected ListDataListener创建一个将添加到ComboBoxModel的列表数据监听器。protected MouseListener创建一个鼠标监听,用于监视弹出列表中的鼠标事件。protected MouseMotionListener创建一个鼠标运动监听,用于监视弹出列表中的鼠标运动事件。protected ListSelectionListener创建一个列表选择监听,用于监视弹出列表中的选择更改。protected MouseListener创建一个监听,用于监视组合框上的鼠标按下和释放事件。protected MouseMotionListener创建将添加到组合框的鼠标运动监听。protected PropertyChangeListener创建将添加到组合框的PropertyChangeListener。protected JScrollPane创建包含可滚动列表的滚动窗格。protected void这是一个实用程序方法,可帮助事件处理程序确定弹出窗口出现时将焦点发送到何处。获取与此 BasicComboPopup 关联的 AccessibleContext。ComboPopup.getKeyListener() 的实现。getList()ComboPopup.getList() 的实现。ComboPopup.getMouseListener() 的实现。ComboPopup.getMouseMotionListener() 的实现。protected intgetPopupHeightForRowCount(int maxRowCount) 根据当前 ListCellRenderer 和最大行数检索弹出窗口的高度。voidhide()ComboPopup.hide() 的实现。protected void此方法将必要的监听添加到 JComboBox。protected voidinstallComboBoxModelListeners(ComboBoxModel<?> model) 在组合框模型上安装监听。protected void注册键盘操作。protected void将监听添加到列表控件。boolean重写以无条件返回 false。voidshow()ComboPopup.show() 的实现。protected voidstartAutoScrolling(int direction) 这个受保护的方法是特定于实现的,应该是私有的。protected void这个受保护的方法是特定于实现的,应该是私有的。protected void如果弹出窗口隐藏则使其可见,如果弹出窗口可见则使其隐藏。protected voiduninstallComboBoxModelListeners(ComboBoxModel<?> model) 从组合框模型中删除监听void在 UI 卸载时调用。protected void注销键盘操作。protected voidupdateListBoxSelectionForEvent(MouseEvent anEvent, boolean shouldScroll) 事件监听使用的实用方法。在类 javax.swing.JPopupMenu 中声明的方法
add, add, add, addMenuKeyListener, addPopupMenuListener, addSeparator, createActionChangeListener, createActionComponent, firePopupMenuCanceled, firePopupMenuWillBecomeInvisible, firePopupMenuWillBecomeVisible, getComponent, getComponentAtIndex, getComponentIndex, getDefaultLightWeightPopupEnabled, getInvoker, getLabel, getMargin, getMenuKeyListeners, getPopupMenuListeners, getSelectionModel, getSubElements, getUI, getUIClassID, insert, insert, isBorderPainted, isLightWeightPopupEnabled, isPopupTrigger, isVisible, menuSelectionChanged, pack, paintBorder, paramString, processKeyEvent, processKeyEvent, processMouseEvent, remove, removeMenuKeyListener, removePopupMenuListener, setBorderPainted, setDefaultLightWeightPopupEnabled, setInvoker, setLabel, setLightWeightPopupEnabled, setLocation, setPopupSize, setPopupSize, setSelected, setSelectionModel, setUI, setVisible, show, updateUI在类 javax.swing.JComponent 中声明的方法
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, 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, getMinimumSize, getNextFocusableComponent, getPopupLocation, getPreferredSize, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, unregisterKeyboardAction, update在类 java.awt.Container 中声明的方法
add, add, add, add, add, addContainerListener, addImpl, 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, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTree在类 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, 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, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, 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, setMixingCutoutShape, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle在类 java.lang.Object 中声明的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait在接口 javax.swing.plaf.basic.ComboPopup 中声明的方法
isVisible
-
字段详细信息
-
comboBox
JComboBox的实例。 -
list
该受保护字段是特定于实现的。不要直接访问或重写。请改用访问器方法。- 参见:
-
scroller
该受保护字段是特定于实现的。不要直接访问或重写。改为使用 create 方法- 参见:
-
valueIsAdjusting
protected boolean valueIsAdjusting从 Java 2 平台 v1.4 开始,不再使用这个以前未记录的字段。 -
mouseMotionListener
该受保护字段是特定于实现的。不要直接访问或重写。请改用访问器或创建方法。- 参见:
-
mouseListener
该受保护字段是特定于实现的。不要直接访问或重写。请改用访问器或创建方法。- 参见:
-
keyListener
该受保护字段是特定于实现的。不要直接访问或重写。请改用访问器或创建方法。- 参见:
-
listSelectionListener
该受保护字段是特定于实现的。不要直接访问或重写。请改用创建方法。- 参见:
-
listMouseListener
该受保护字段是特定于实现的。不要直接访问或重写。请改用创建方法。- 参见:
-
listMouseMotionListener
该受保护字段是特定于实现的。不要直接访问或重写。改为使用 create 方法- 参见:
-
propertyChangeListener
该受保护字段是特定于实现的。不要直接访问或重写。改为使用 create 方法- 参见:
-
listDataListener
该受保护字段是特定于实现的。不要直接访问或重写。改为使用 create 方法- 参见:
-
itemListener
该受保护字段是特定于实现的。不要直接访问或重写。改为使用 create 方法- 参见:
-
autoscrollTimer
该受保护字段是特定于实现的。不要直接访问或重写。 -
hasEntered
protected boolean hasEnteredtrue如果鼠标光标在弹出窗口中。 -
isAutoScrolling
protected boolean isAutoScrolling如果true启用自动滚动。 -
scrollDirection
protected int scrollDirection滚动的方向。 -
SCROLL_UP
protected static final int SCROLL_UP向上滚动的方向。- 参见:
-
SCROLL_DOWN
protected static final int SCROLL_DOWN向下滚动的方向。- 参见:
-
-
构造方法详细信息
-
BasicComboPopup
构造一个BasicComboPopup新实例- 参数:
combo-JComboBox的实例
-
-
方法详情
-
show
public void show()ComboPopup.show() 的实现。- 指定者:
show在接口ComboPopup中- 重写:
show在类Component中
-
hide
public void hide()ComboPopup.hide() 的实现。- 指定者:
hide在接口ComboPopup中- 重写:
hide在类JComponent中
-
getList
ComboPopup.getList() 的实现。- 指定者:
getList在接口ComboPopup中- 返回:
- 用于在组合框中绘制项目的列表
-
getMouseListener
ComboPopup.getMouseListener() 的实现。- 指定者:
getMouseListener在接口ComboPopup中- 返回:
MouseListener或空- 参见:
-
getMouseMotionListener
ComboPopup.getMouseMotionListener() 的实现。- 指定者:
getMouseMotionListener在接口ComboPopup中- 返回:
MouseMotionListener或空- 参见:
-
getKeyListener
ComboPopup.getKeyListener() 的实现。- 指定者:
getKeyListener在接口ComboPopup中- 返回:
KeyListener或空- 参见:
-
uninstallingUI
public void uninstallingUI()在 UI 卸载时调用。由于此弹出窗口不在组件树中,因此不会调用它的 uninstallUI()。它删除了在 addComboBoxListeners() 中添加的监听。- 指定者:
uninstallingUI在接口ComboPopup中
-
uninstallComboBoxModelListeners
从组合框模型中删除监听- 参数:
model- 安装监听器的组合框模型- 参见:
-
uninstallKeyboardActions
protected void uninstallKeyboardActions()注销键盘操作。 -
createMouseListener
创建一个监听器,用于监视组合框上的鼠标按下和释放事件。 Warning:覆盖此方法时,请确保保持现有行为。- 返回:
-
将添加到组合框的
MouseListener或 null
-
createMouseMotionListener
创建将添加到组合框的鼠标运动监听器。 Warning:覆盖此方法时,请确保保持现有行为。- 返回:
-
将添加到组合框的
MouseMotionListener或 null
-
createKeyListener
创建将添加到组合框的键监听。如果此方法返回 null,则不会将其添加到组合框中。- 返回:
KeyListener或空
-
createListSelectionListener
创建一个列表选择监听,用于监视弹出列表中的选择更改。如果此方法返回 null,则不会将其添加到弹出列表中。- 返回:
ListSelectionListener的实例或 null
-
createListDataListener
创建一个将添加到ComboBoxModel的列表数据监听器。如果此方法返回 null,则不会将其添加到组合框模型中。- 返回:
ListDataListener的实例或 null
-
createListMouseListener
创建一个鼠标监听,用于监视弹出列表中的鼠标事件。如果此方法返回 null,则不会将其添加到组合框中。- 返回:
MouseListener的实例或 null
-
createListMouseMotionListener
创建一个鼠标运动监听,用于监视弹出列表中的鼠标运动事件。如果此方法返回 null,则不会将其添加到组合框中。- 返回:
MouseMotionListener的实例或 null
-
createPropertyChangeListener
创建将添加到组合框的PropertyChangeListener。如果此方法返回 null,则不会将其添加到组合框中。- 返回:
PropertyChangeListener的实例或 null
-
createItemListener
创建将添加到组合框的ItemListener。如果此方法返回 null,则不会将其添加到组合框中。子类可以重写此方法以返回它们自己的 ItemEvent 处理程序的实例。
- 返回:
ItemListener或 null 的实例
-
createList
创建弹出窗口中使用的 JList 以显示组合框模型中的项目。创建 UI 类时调用此方法。- 返回:
JList用于显示组合框项目
-
configureList
protected void configureList()配置用于在弹出窗口中保存组合框项目的列表。创建 UI 类时调用此方法。- 参见:
-
installListListeners
protected void installListListeners()将监听添加到列表控件。 -
createScroller
创建包含可滚动列表的滚动窗格。- 返回:
- 包含可滚动列表的滚动窗格
-
configureScroller
protected void configureScroller()配置在组合框弹出窗口中保存列表的可滚动部分。创建 UI 类时调用此方法。 -
configurePopup
protected void configurePopup()配置组合框的弹出部分。创建 UI 类时调用此方法。 -
installComboBoxListeners
protected void installComboBoxListeners()此方法将必要的监听添加到 JComboBox。 -
installComboBoxModelListeners
在组合框模型上安装监听器。组合框模型上安装的任何监听器都应在uninstallComboBoxModelListeners中删除。- 参数:
model- 安装监听器的组合框模型- 参见:
-
installKeyboardActions
protected void installKeyboardActions()注册键盘操作。 -
isFocusTraversable
public boolean isFocusTraversable()重写以无条件返回 false。- 重写:
isFocusTraversable在类Component中- 返回:
true如果这个Component是可聚焦的;false否则- 参见:
-
startAutoScrolling
protected void startAutoScrolling(int direction) 这个受保护的方法是特定于实现的,应该是私有的。请勿调用或重写。- 参数:
direction- 滚动方向
-
stopAutoScrolling
protected void stopAutoScrolling()这个受保护的方法是特定于实现的,应该是私有的。请勿调用或重写。 -
autoScrollUp
protected void autoScrollUp()这个受保护的方法是特定于实现的,应该是私有的。请勿调用或重写。 -
autoScrollDown
protected void autoScrollDown()这个受保护的方法是特定于实现的,应该是私有的。请勿调用或重写。 -
getAccessibleContext
获取与此 BasicComboPopup 关联的 AccessibleContext。 AccessibleContext 将其父级设置为 ComboBox。- 指定者:
getAccessibleContext在接口Accessible中- 重写:
getAccessibleContext在类JPopupMenu中- 返回:
- BasicComboPopup 的 AccessibleContext
- 自从:
- 1.5
-
delegateFocus
这是一个实用程序方法,可帮助事件处理程序确定弹出窗口出现时将焦点发送到何处。标准实现将焦点委托给编辑器(如果组合框可编辑)或 JComboBox(如果它不可编辑)。- 参数:
e- 鼠标事件
-
togglePopup
protected void togglePopup()如果弹出窗口隐藏则使其可见,如果弹出窗口可见则使其隐藏。 -
convertMouseEvent
转换鼠标事件。- 参数:
e- 鼠标事件- 返回:
- 转换鼠标事件
-
getPopupHeightForRowCount
protected int getPopupHeightForRowCount(int maxRowCount) 根据当前 ListCellRenderer 和最大行数检索弹出窗口的高度。- 参数:
maxRowCount- 行数- 返回:
- 弹出窗口的高度
-
computePopupBounds
根据组合框位置和封闭屏幕边界计算组合框弹出部分的位置和大小。如果不需要转换,则返回的矩形将具有与参数相同的值。- 参数:
px- 起始 x 位置py- 起始 y 位置pw- 起始宽度ph- 起始高度- 返回:
- 代表弹出窗口位置和大小的矩形
-
updateListBoxSelectionForEvent
事件监听使用的实用方法。给定鼠标事件,它将列表选择更改为鼠标下方的列表项。- 参数:
anEvent- 鼠标事件shouldScroll- 如果应滚动true列表。
-