public class BasicComboPopup extends JPopupMenu implements ComboPopup
ComboPopup
接口实现。这类表示的组合框弹出部分UI。
所有的事件处理是通过监听器类与createxxxListener()
方法和内部类创建的处理。你可以通过重写createxxxListener()
方法和提供您自己的事件侦听器或子类在这类提供的这类行为的变化。
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans
包。请看XMLEncoder
。
Modifier and Type | Class and Description |
---|---|
class |
BasicComboPopup.InvocationKeyHandler
作为java 2平台V 1.4,这类已经过时了,它只包括向后兼容的API。
|
protected class |
BasicComboPopup.InvocationMouseHandler
听众可以在组合框中注册(不是它的弹出菜单)来处理鼠标事件影响的弹出式菜单的状态。
|
protected class |
BasicComboPopup.InvocationMouseMotionHandler
此侦听器监视列表中的当前选择,如果它正在拖动列表,则拖动并更新当前选择列表中的选项。
|
protected class |
BasicComboPopup.ItemHandler
此侦听器监视组合框中的选择的更改。
|
class |
BasicComboPopup.ListDataHandler
截至1.4,这个类现在已经过时了,不做任何事情,只包括向后的接口的兼容性。
|
protected class |
BasicComboPopup.ListMouseHandler
这位听众隐藏弹出当鼠标在名单公布。
|
protected class |
BasicComboPopup.ListMouseMotionHandler
当您在列表中移动鼠标时,此侦听器更改所选项目。
|
protected class |
BasicComboPopup.ListSelectionHandler
作为java 2平台V 1.4,这类现在已经过时了,什么都不做,而只包括向后兼容的API。
|
protected class |
BasicComboPopup.PropertyChangeHandler
此侦听器监视组合框中已更改的绑定属性。
|
JPopupMenu.AccessibleJPopupMenu, JPopupMenu.Separator
JComponent.AccessibleJComponent
Container.AccessibleAWTContainer
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
Modifier and Type | Field and Description |
---|---|
protected Timer |
autoscrollTimer
这个保护字段是实现特定的。
|
protected JComboBox |
comboBox |
protected boolean |
hasEntered |
protected boolean |
isAutoScrolling |
protected ItemListener |
itemListener
这个保护字段是实现特定的。
|
protected KeyListener |
keyListener
这个保护字段是实现特定的。
|
protected JList |
list
这个保护字段是实现特定的。
|
protected ListDataListener |
listDataListener
这个保护字段是实现特定的。
|
protected MouseListener |
listMouseListener
这个保护字段是实现特定的。
|
protected MouseMotionListener |
listMouseMotionListener
这个保护字段是实现特定的。
|
protected ListSelectionListener |
listSelectionListener
这个保护字段是实现特定的。
|
protected MouseListener |
mouseListener
这个保护字段是实现特定的。
|
protected MouseMotionListener |
mouseMotionListener
这个保护字段是实现特定的。
|
protected PropertyChangeListener |
propertyChangeListener
这个保护字段是实现特定的。
|
protected static int |
SCROLL_DOWN |
protected static int |
SCROLL_UP |
protected int |
scrollDirection |
protected JScrollPane |
scroller
这个保护字段是实现特定的。
|
protected boolean |
valueIsAdjusting
这以前无证场java 2平台v1.4是不再使用。
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
accessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
Constructor and Description |
---|
BasicComboPopup(JComboBox combo) |
Modifier and Type | Method and Description |
---|---|
protected void |
autoScrollDown()
这种保护的方法是实现特定的,应该是私有的。
|
protected void |
autoScrollUp()
这种保护的方法是实现特定的,应该是私有的。
|
protected Rectangle |
computePopupBounds(int px, int py, int pw, int ph)
计算出的位置和基于组合框的位置和封闭屏幕边界的组合框弹出部分的大小。
|
protected void |
configureList()
配置列表,用于在弹出的持有组合框的项目。
|
protected void |
configurePopup()
配置的组合框弹出的部分。
|
protected void |
configureScroller()
配置持有的列表组合框弹出的滚动部分。
|
protected MouseEvent |
convertMouseEvent(MouseEvent e) |
protected ItemListener |
createItemListener()
创建一个
ItemListener 这将被添加到组合框。
|
protected KeyListener |
createKeyListener()
创建将被添加到组合框中的关键侦听器。
|
protected JList |
createList()
创建用于弹出显示在组合框中的项的列表框模型。
|
protected ListDataListener |
createListDataListener()
创建一个列表数据侦听器将被添加到
ComboBoxModel 。
|
protected MouseListener |
createListMouseListener()
创建一个鼠标监听器,在弹出的列表鼠标事件表。
|
protected MouseMotionListener |
createListMouseMotionListener()
创建一个鼠标运动的听众,在弹出的列表鼠标移动事件表。
|
protected ListSelectionListener |
createListSelectionListener()
创建一个列表,选择监听器,在弹出的列表中选择变化表。
|
protected MouseListener |
createMouseListener()
创建一个侦听器,该侦听器将监视组合框上的鼠标新闻和发布事件。
|
protected MouseMotionListener |
createMouseMotionListener()
创建将被添加到组合框中的鼠标移动侦听器。
|
protected PropertyChangeListener |
createPropertyChangeListener()
创建一个
PropertyChangeListener 这将被添加到组合框。
|
protected JScrollPane |
createScroller()
创建滚动窗格里面的可滚动列表。
|
protected void |
delegateFocus(MouseEvent e)
这是一个实用的方法,有助于事件处理程序找出发送的焦点时,弹出了。
|
protected void |
firePopupMenuCanceled()
通知
PopupMenuListeners 这个弹出菜单被取消。
|
protected void |
firePopupMenuWillBecomeInvisible()
通知
PopupMenuListener s这个弹出菜单将成为无形。
|
protected void |
firePopupMenuWillBecomeVisible()
通知
PopupMenuListener s这个弹出菜单将变得可见。
|
AccessibleContext |
getAccessibleContext()
获取与此相关的accessiblecontext BasicComboPopup。
|
KeyListener |
getKeyListener()
实现getkeylistener() combopopup。
|
JList |
getList()
实现getlist() combopopup。
|
MouseListener |
getMouseListener()
实现getmouselistener() combopopup。
|
MouseMotionListener |
getMouseMotionListener()
实现getmousemotionlistener() combopopup。
|
protected int |
getPopupHeightForRowCount(int maxRowCount)
检索基于当前listcellrenderer和最大行数的弹出高度。
|
void |
hide()
实现hide() combopopup。
|
protected void |
installComboBoxListeners()
该方法添加必要的听众的JComboBox。
|
protected void |
installComboBoxModelListeners(ComboBoxModel model)
在组合框模型上安装侦听器。
|
protected void |
installKeyboardActions() |
protected void |
installListListeners()
将侦听器添加到列表控件中。
|
boolean |
isFocusTraversable()
以无条件返回false。
|
void |
show()
实现show() combopopup。
|
protected void |
startAutoScrolling(int direction)
这种保护的方法是实现特定的,应该是私有的。
|
protected void |
stopAutoScrolling()
这种保护的方法是实现特定的,应该是私有的。
|
protected void |
togglePopup()
使弹出可见如果是隐藏的,它如果是可见的隐藏。
|
protected void |
uninstallComboBoxModelListeners(ComboBoxModel model)
从组合框模型中移除侦听器
|
void |
uninstallingUI()
所谓的UI是卸载时。
|
protected void |
uninstallKeyboardActions() |
protected void |
updateListBoxSelectionForEvent(MouseEvent anEvent, boolean shouldScroll)
事件侦听器使用的一种实用方法。
|
add, add, add, addMenuKeyListener, addPopupMenuListener, addSeparator, createActionChangeListener, createActionComponent, getComponent, getComponentAtIndex, getComponentIndex, getDefaultLightWeightPopupEnabled, getInvoker, getLabel, getMargin, getMenuKeyListeners, getPopupMenuListeners, getSelectionModel, getSubElements, getUI, getUIClassID, insert, insert, isBorderPainted, isLightWeightPopupEnabled, isPopupTrigger, isVisible, menuSelectionChanged, pack, paintBorder, paramString, processFocusEvent, processKeyEvent, processKeyEvent, processMouseEvent, remove, removeMenuKeyListener, removePopupMenuListener, setBorderPainted, setDefaultLightWeightPopupEnabled, setInvoker, setLabel, setLightWeightPopupEnabled, setLocation, setPopupSize, setPopupSize, setSelected, setSelectionModel, setUI, setVisible, show, updateUI
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, 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
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
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, getPeer, 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, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setName, setSize, setSize, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCycle
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
isVisible
protected JComboBox comboBox
protected JList list
getList()
,
createList()
protected JScrollPane scroller
createScroller()
protected boolean valueIsAdjusting
protected MouseMotionListener mouseMotionListener
protected MouseListener mouseListener
protected KeyListener keyListener
protected ListSelectionListener listSelectionListener
protected MouseListener listMouseListener
protected MouseMotionListener listMouseMotionListener
protected PropertyChangeListener propertyChangeListener
protected ListDataListener listDataListener
createListDataListener()
protected ItemListener itemListener
createItemListener()
protected Timer autoscrollTimer
protected boolean hasEntered
protected boolean isAutoScrolling
protected int scrollDirection
protected static final int SCROLL_UP
protected static final int SCROLL_DOWN
public BasicComboPopup(JComboBox combo)
public void show()
show
接口
ComboPopup
show
方法重写,继承类
Component
public void hide()
hide
接口
ComboPopup
hide
方法重写,继承类
JComponent
public JList getList()
getList
接口
ComboPopup
public MouseListener getMouseListener()
getMouseListener
接口
ComboPopup
MouseListener
或空
ComboPopup.getMouseListener()
public MouseMotionListener getMouseMotionListener()
getMouseMotionListener
接口
ComboPopup
MouseMotionListener
或空
ComboPopup.getMouseMotionListener()
public KeyListener getKeyListener()
getKeyListener
接口
ComboPopup
KeyListener
或空
ComboPopup.getKeyListener()
public void uninstallingUI()
uninstallingUI
接口
ComboPopup
protected void uninstallComboBoxModelListeners(ComboBoxModel model)
model
-安装听众组合框模型
installComboBoxModelListeners(javax.swing.ComboBoxModel)
protected void uninstallKeyboardActions()
protected void firePopupMenuWillBecomeVisible()
JPopupMenu
PopupMenuListener
s这个弹出菜单将变得可见。
firePopupMenuWillBecomeVisible
方法重写,继承类
JPopupMenu
protected void firePopupMenuWillBecomeInvisible()
JPopupMenu
PopupMenuListener
s这个弹出菜单将成为无形。
firePopupMenuWillBecomeInvisible
方法重写,继承类
JPopupMenu
protected void firePopupMenuCanceled()
JPopupMenu
PopupMenuListeners
这个弹出菜单被取消。
firePopupMenuCanceled
方法重写,继承类
JPopupMenu
protected MouseListener createMouseListener()
MouseListener
这将被添加到组合框或空
protected MouseMotionListener createMouseMotionListener()
MouseMotionListener
这将被添加到组合框或空
protected KeyListener createKeyListener()
KeyListener
或空
protected ListSelectionListener createListSelectionListener()
ListSelectionListener
或空的实例
protected ListDataListener createListDataListener()
ComboBoxModel
。如果此方法返回的空值,则不会添加到组合框模型中。
ListDataListener
或空的实例
protected MouseListener createListMouseListener()
MouseListener
或空的实例
protected MouseMotionListener createListMouseMotionListener()
MouseMotionListener
或空的实例
protected PropertyChangeListener createPropertyChangeListener()
PropertyChangeListener
这将被添加到组合框。如果此方法返回的空值,则不会被添加到组合框中。
PropertyChangeListener
或空的实例
protected ItemListener createItemListener()
ItemListener
这将被添加到组合框。如果此方法返回的空值,则不会被添加到组合框中。
子类可以重写此方法以返回自己的itemevent处理实例。
ItemListener
或空的实例
protected JList createList()
JList
用来显示组合框的项目
protected void configureList()
createList()
protected void installListListeners()
protected JScrollPane createScroller()
protected void configureScroller()
protected void configurePopup()
protected void installComboBoxListeners()
protected void installComboBoxModelListeners(ComboBoxModel model)
uninstallComboBoxModelListeners
。
model
-安装听众组合框模型
uninstallComboBoxModelListeners(javax.swing.ComboBoxModel)
protected void installKeyboardActions()
public boolean isFocusTraversable()
isFocusTraversable
方法重写,继承类
Component
true
Component
聚焦;
false
否则
Component.setFocusable(boolean)
protected void startAutoScrolling(int direction)
protected void stopAutoScrolling()
protected void autoScrollUp()
protected void autoScrollDown()
public AccessibleContext getAccessibleContext()
getAccessibleContext
接口
Accessible
getAccessibleContext
方法重写,继承类
JPopupMenu
protected void delegateFocus(MouseEvent e)
protected void togglePopup()
protected MouseEvent convertMouseEvent(MouseEvent e)
protected int getPopupHeightForRowCount(int maxRowCount)
protected Rectangle computePopupBounds(int px, int py, int pw, int ph)
px
启动X的位置
py
-启动位置
pw
-起点宽度
ph
启动高度
protected void updateListBoxSelectionForEvent(MouseEvent anEvent, boolean shouldScroll)
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2014, Oracle and/or its affiliates. All rights reserved.