E -此列表中的元素的类型
public class JList<E> extends JComponent implements Scrollable, Accessible
ListModel,保持列表的内容。
显示一个数组或向量的对象很容易,使用自动建立一个只读ListModel实例为你JList构造函数:
// Create a JList that displays strings from an array
String[] data = {"one", "two", "three", "four"};
JList<String> myList = new JList<String>(data);
// Create a JList that displays the superclasses of JList.class, by
// creating it with a Vector populated with this data
Vector<Class<?>> superClasses = new Vector<Class<?>>();
Class<JList> rootClass = javax.swing.JList.class;
for(Class<?> cls = rootClass; cls != null; cls = cls.getSuperclass()) {
superClasses.addElement(cls);
}
JList<Class<?>> myList = new JList<Class<?>>(superClasses);
// The automatically created model is stored in JList's "model"
// property, which you can retrieve
ListModel<Class<?>> model = myList.getModel();
for(int i = 0; i < model.getSize(); i++) {
System.out.println(model.getElementAt(i));
}
一个ListModel可以直接供应到JList通过构造函数或方法的setModel。内容不需要是静态的-项目的数量,项目的价值可以随着时间的推移而改变。一个正确的ListModel执行通知已被添加到它javax.swing.event.ListDataListeners集,每次发生变化。这些变化的特点是javax.swing.event.ListDataEvent,标识列表索引已被修改,添加或删除的范围。JList的ListUI负责保持视觉表现跟上变化,通过听模型。
简单的、动态的内容,JList应用程序可以使用DefaultListModel阶级维护列表元素。该类实现了ListModel接口,还提供了一个java.util.Vector-like API。这需要更多的自定义ListModel实施应用可能希望AbstractListModel的子类,用于管理和通知听众提供了基本的支持。例如,一个只读的实现AbstractListModel:
// This list model has about 2^16 elements. Enjoy scrolling.
ListModel<String> bigData = new AbstractListModel<String>() {
public int getSize() { return Short.MAX_VALUE; }
public String getElementAt(int index) { return "Index " + index; }
};
一个JList选择状态是由另一个独立的管理模式,对ListSelectionModel实例。JList与施工选择模型初始化,也包含方法查询或设置选择模型。此外,JList易于管理的选择提供了方便的方法。这些方法,如setSelectedIndex和getSelectedValue,覆盖方法,照顾与选择模型的交互细节。默认情况下,JList的选择模式设置为允许项目任意组合,同时被选择;选择模式MULTIPLE_INTERVAL_SELECTION。选择模式,可以改变在选择模型直接或通过JList的覆盖方法。为响应用户的动作更新选择模型的责任在于列表的ListUI。
一个正确的ListSelectionModel执行通知已经添加的每一次变化发生在javax.swing.event.ListSelectionListeners选择集。这些变化的特点是javax.swing.event.ListSelectionEvent,确定选择范围的变化。
听在列表选择变化的首选方法是添加ListSelectionListeners直接向JList。JList然后照顾听的选择模型,并通知你的听众的变化。
听选择的变化以保持列表的视觉表现到目前为止是列表中的ListUI责任。
在JList细胞画是由一个代表称为细胞器,安装在列为cellRenderer财产。渲染器提供了一个java.awt.Component是使用像“橡皮图章”画的细胞。每当一个细胞需要被重画,列表的ListUI要求组成细胞的渲染,把它移动到的位置,并通过其paint法涂料单元格的内容。默认单元格渲染器,它采用JLabel组件来呈现,通过列表的ListUI安装。你可以用你自己的渲染器使用这样的代码:
// Display an icon and a string for each object in the list.
class MyCellRenderer extends JLabel implements ListCellRenderer<Object> {
final static ImageIcon longIcon = new ImageIcon("long.gif");
final static ImageIcon shortIcon = new ImageIcon("short.gif");
// This is the only method defined by ListCellRenderer.
// We just reconfigure the JLabel each time we're called.
public Component getListCellRendererComponent(
JList<?> list, // the list
Object value, // value to display
int index, // cell index
boolean isSelected, // is the cell selected
boolean cellHasFocus) // does the cell have focus
{
String s = value.toString();
setText(s);
setIcon((s.length() > 10) ? longIcon : shortIcon);
if (isSelected) {
setBackground(list.getSelectionBackground());
setForeground(list.getSelectionForeground());
} else {
setBackground(list.getBackground());
setForeground(list.getForeground());
}
setEnabled(list.isEnabled());
setFont(list.getFont());
setOpaque(true);
return this;
}
}
myList.setCellRenderer(new MyCellRenderer());
对于细胞渲染另一份工作是帮助确定列表大小的信息。默认情况下,列表中的ListUI问细胞渲染为每个列表项的首选大小决定了细胞的大小。这可能是昂贵的大名单的项目。为了避免这些计算,你可以设置一个fixedCellWidth和fixedCellHeight名单上,或者这些值基于一个单一的原型值自动计算:
JList<String> bigDataList = new JList<String>(bigData);
// We don't want the JList implementation to compute the width
// or height of all of the list cells, so we give it a string
// that's as big as we'll need for any cell. It uses this to
// compute values for the fixedCellWidth and fixedCellHeight
// properties.
bigDataList.setPrototypeCellValue("Index 1234567890");
JList不直接实施滚动。创建一个列表,滚动,使它的一个JScrollPane视口视图。例如:
JScrollPane滚动窗格=新JScrollPane(mylist);/ /或在两个步骤:JScrollPane滚动窗格=新jscrollpane();滚动窗格。getviewport() setView(mylist);
JList不提供双或三任何特殊处理(或N)的鼠标点击,但很容易如果你想对这些事件采取行动增加MouseListener。使用locationToIndex方法确定哪些单元格被点击了。例如:
MouseListener MouseListener =新mouseadapter() {public void mouseClicked(MouseEvent e){如果(如getclickcount() = = 2){指数=列表。locationtoindex(E. getpoint());系统的输入(“双击”项指标);}}};列表。addMouseListener(MouseListener);
警告: Swing是线程不安全的。更多信息见Swing's Threading Policy。
警告:序列化该类的对象与以后的Swing版本不兼容。当前的序列化支持适用于短期贮藏或RMI运行相同Swing版本的应用程序之间。为1.4,为所有JavaBeans™长期存储的支持已被添加到java.beans包。请看XMLEncoder。
看到进一步的文件在The Java Tutorial How to Use Lists。
| Modifier and Type | Class and Description |
|---|---|
protected class |
JList.AccessibleJList
这个类实现了对
JList类可访问性支持。
|
static class |
JList.DropLocation
对
TransferHandler.DropLocation表示一个
JList下降位置的子类。
|
JComponent.AccessibleJComponentContainer.AccessibleAWTContainerComponent.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy| Modifier and Type | Field and Description |
|---|---|
static int |
HORIZONTAL_WRAP
表示水平垂直的单元格的“报样式”布局。
|
static int |
VERTICAL
表示单元格的垂直布局,在一个列中;默认布局。
|
static int |
VERTICAL_WRAP
表示垂直水平的单元格的“报样式”布局。
|
listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOWaccessibleContext, BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENTABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH| Constructor and Description |
|---|
JList()
构建了一个
JList空,只读模式。
|
JList(E[] listData)
构建了一个
JList显示指定数组中的元素。
|
JList(ListModel<E> dataModel)
构建了一个
JList显示元素从指定的,
non-null,模型。
|
JList(Vector<? extends E> listData)
构建了一个
JList显示在指定的
Vector元素。
|
| Modifier and Type | Method and Description |
|---|---|
void |
addListSelectionListener(ListSelectionListener listener)
将一个侦听器添加到列表中,每次更改到选择时都会被通知;侦听选择状态更改的首选方式是。
|
void |
addSelectionInterval(int anchor, int lead)
设置选择是指定的间隔与当前选择的联盟。
|
void |
clearSelection()
清除选择;调用此方法后,
isSelectionEmpty将返回
true。
|
protected ListSelectionModel |
createSelectionModel()
返回
DefaultListSelectionModel实例;称为施工期间初始化列表的选择模型属性。
|
void |
ensureIndexIsVisible(int index)
在一个封闭的滚动列表视图使指定的细胞完全可见。
|
protected void |
fireSelectionValueChanged(int firstIndex, int lastIndex, boolean isAdjusting)
通知
ListSelectionListeners直接添加到了列表选择模型选择的变化。
|
AccessibleContext |
getAccessibleContext()
获取与此相关的
AccessibleContext
JList。
|
int |
getAnchorSelectionIndex()
返回锚定选择索引。
|
Rectangle |
getCellBounds(int index0, int index1)
返回在列表的坐标系统中的边界矩形,用于由两个索引指定的单元格的范围。
|
ListCellRenderer<? super E> |
getCellRenderer()
返回负责画列表项的对象。
|
boolean |
getDragEnabled()
返回是否启用自动拖动处理。
|
JList.DropLocation |
getDropLocation()
返回的位置,这个组件应该在视觉上显示为下降位置DND操作期间在组件,或
null如果没有定位是目前被证明。
|
DropMode |
getDropMode()
返回此组件的下拉模式。
|
int |
getFirstVisibleIndex()
返回当前可见的最小列表索引。
|
int |
getFixedCellHeight()
返回的
fixedCellHeight属性的值。
|
int |
getFixedCellWidth()
返回的
fixedCellWidth属性的值。
|
int |
getLastVisibleIndex()
返回当前可见的最大列表索引。
|
int |
getLayoutOrientation()
返回列表的布局定位属性:
VERTICAL如果布局是单柱细胞,
VERTICAL_WRAP如果布局是“报纸”风格与内容垂直然后水平流动,或
HORIZONTAL_WRAP如果布局是“报纸”风格与内容水平再垂直流动。
|
int |
getLeadSelectionIndex()
返回引线选择索引。
|
ListSelectionListener[] |
getListSelectionListeners()
返回所有的
ListSelectionListeners数组添加到这个
JList通过
addListSelectionListener。
|
int |
getMaxSelectionIndex()
收益最大的选择的细胞指数,或
-1如果选择是空的。
|
int |
getMinSelectionIndex()
返回最小的选择细胞指数,或
-1如果选择是空的。
|
ListModel<E> |
getModel()
返回的数据模型,是由
JList组件显示项目列表。
|
int |
getNextMatch(String prefix, int startIndex, Position.Bias bias)
返回下一个列表元素的
toString值从给定的前缀。
|
Dimension |
getPreferredScrollableViewportSize()
计算需要显示
visibleRowCount行视口的大小。
|
E |
getPrototypeCellValue()
返回“原型”单元格值-用于计算单元格的固定宽度和高度的值。
|
int |
getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
返回滚动的距离,以暴露下一个或前一个块。
|
boolean |
getScrollableTracksViewportHeight()
返回
true如果这
JList在
JViewport和视口显示比列表的首选高度更高,或者如果布局的方向是
VERTICAL_WRAP和
visibleRowCount <= 0;否则返回
false。
|
boolean |
getScrollableTracksViewportWidth()
返回
true如果这
JList在
JViewport和视口显示比列表的首选宽度更宽,或如果布局的方向是
HORIZONTAL_WRAP和
visibleRowCount <= 0;否则返回
false。
|
int |
getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
返回滚动的距离,以暴露下一个或上一行(垂直滚动)或列(用于水平滚动)。
|
int |
getSelectedIndex()
返回最小的选择细胞指数;选择当只有一个单一的项目列表中选择。
|
int[] |
getSelectedIndices()
返回所有选定的索引的数组,以递增顺序。
|
E |
getSelectedValue()
返回选定的细胞指数最小值;选择的价值当只有一个单一的项目列表中选择。
|
Object[] |
getSelectedValues()
过时的。
作为JDK 1.7,取而代之的
getSelectedValuesList()
|
List<E> |
getSelectedValuesList()
返回所有选定项目的列表,在列表中的索引的基础上增加的顺序。
|
Color |
getSelectionBackground()
返回用于绘制选定项目背景的颜色。
|
Color |
getSelectionForeground()
返回用于绘制所选项目的前景的颜色。
|
int |
getSelectionMode()
返回列表的当前选择模式。
|
ListSelectionModel |
getSelectionModel()
返回当前选择模型。
|
String |
getToolTipText(MouseEvent event)
返回可用于给定的事件的工具提示文本。
|
ListUI |
getUI()
返回
ListUI,外观和感觉的对象,使得这部分。
|
String |
getUIClassID()
返回的
"ListUI",
UIDefaults密钥用于查找定义看
javax.swing.plaf.ListUI类的名字,觉得这个组件。
|
boolean |
getValueIsAdjusting()
返回选择模型的
isAdjusting属性的值。
|
int |
getVisibleRowCount()
返回的
visibleRowCount属性的值。
|
Point |
indexToLocation(int index)
返回列表坐标系中指定项目的原点。
|
boolean |
isSelectedIndex(int index)
返回
true如果指定的索引选择,其他
false。
|
boolean |
isSelectionEmpty()
返回
true如果没有被选中,否则
false。
|
int |
locationToIndex(Point location)
返回列表坐标系统中最接近给定位置的单元格索引。
|
protected String |
paramString()
返回该
JList一
String表示。
|
void |
removeListSelectionListener(ListSelectionListener listener)
从列表中移除一个选择侦听器。
|
void |
removeSelectionInterval(int index0, int index1)
设置选择是指定的间隔的设置差异和当前选择。
|
void |
setCellRenderer(ListCellRenderer<? super E> cellRenderer)
设置用于将列表中的每个单元格绘制的委托。
|
void |
setDragEnabled(boolean b)
打开或关闭自动拖动处理。
|
void |
setDropMode(DropMode dropMode)
设置此组件的下拉模式。
|
void |
setFixedCellHeight(int height)
为列表中的每个单元格的高度设置一个固定值。
|
void |
setFixedCellWidth(int width)
为列表中的每个单元格的宽度设置一个固定值。
|
void |
setLayoutOrientation(int layoutOrientation)
定义列表的细胞布局的方式。
|
void |
setListData(E[] listData)
构建了从项目的数组只读
ListModel,叫
setModel这个模型。
|
void |
setListData(Vector<? extends E> listData)
构建了从
Vector只读
ListModel和电话
setModel这个模型。
|
void |
setModel(ListModel<E> model)
设置表示内容或“值”列表的模式,通知属性改变监听器,然后清除列表中的选择。
|
void |
setPrototypeCellValue(E prototypeCellValue)
集
prototypeCellValue属性,然后(如果新值
non-null),要求的给定值单元格渲染器组件的计算
fixedCellWidth和
fixedCellHeight性质(指数0)从细胞器,和使用该组件的首选大小。
|
void |
setSelectedIndex(int index)
选择单个单元格。
|
void |
setSelectedIndices(int[] indices)
改变选择是给定数组指定的索引集合。
|
void |
setSelectedValue(Object anObject, boolean shouldScroll)
从列表中选择指定的对象。
|
void |
setSelectionBackground(Color selectionBackground)
设置用于绘制选定项的背景的颜色,它的渲染器可以使用填充选定的单元格。
|
void |
setSelectionForeground(Color selectionForeground)
设置用于绘制所选项目的前景颜色,它的渲染器可以使用渲染文本和图形。
|
void |
setSelectionInterval(int anchor, int lead)
选择指定的间隔。
|
void |
setSelectionMode(int selectionMode)
设置列表的选择模式。
|
void |
setSelectionModel(ListSelectionModel selectionModel)
设置列表中的非
null
ListSelectionModel实施
selectionModel。
|
void |
setUI(ListUI ui)
集
ListUI,外观和感觉的对象,使得这部分。
|
void |
setValueIsAdjusting(boolean b)
设置选择模型的
valueIsAdjusting财产。
|
void |
setVisibleRowCount(int visibleRowCount)
集
visibleRowCount属性,具有不同的含义,根据不同的布局定位:一
VERTICAL布局定位,这套行的首选号码显示不需要滚动;其他方向,它影响着细胞的包装。
|
void |
updateUI()
重置
ListUI属性设置为当前看提供的价值和感觉。
|
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, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, hide, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingOrigin, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, 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, setVisible, unregisterKeyboardAction, updateadd, 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, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusDownCycle, validate, validateTreeaction, 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, isFocusTraversable, 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, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusBackward, transferFocusUpCyclepublic static final int VERTICAL
setLayoutOrientation(int),
Constant Field Values
public static final int VERTICAL_WRAP
setLayoutOrientation(int),
Constant Field Values
public static final int HORIZONTAL_WRAP
setLayoutOrientation(int),
Constant Field Values
public JList(ListModel<E> dataModel)
JList显示指定的,
non-null元素模型。所有的
JList建设者代表这一。
这个构造函数注册名单上的ToolTipManager,允许提示被渲染器提供。
dataModel -列表模型
IllegalArgumentException -如果模型
null
public JList(E[] listData)
JList显示指定数组中的元素。此构造函数创建一个只读模型给定的数组,然后代表们以一
ListModel构造函数。
试图通过一个null值,这种方法的结果是未定义的行为,最有可能的例外。创建的模型直接引用给定的数组。在构造未定义的行为之后,试图修改数组的尝试。
listData -对象被加载到数据模型的阵列,
non-null
public JList(Vector<? extends E> listData)
JList显示在指定的
Vector元素。此构造函数创建一个只读模型给定的
Vector,然后代表们以一
ListModel构造函数。
试图通过一个null值,这种方法的结果是未定义的行为,最有可能的例外。创建的模型给出的Vector直接引用。试图修改Vector后未定义行为列表结果构建。
listData -
Vector被加载到数据模型,
non-null
public JList()
JList空,只读模式。
public ListUI getUI()
ListUI,外观和感觉的对象,使得这部分。
ListUI对象,使得这部分
public void setUI(ListUI ui)
ListUI,外观和感觉的对象,使得这部分。
ui -
ListUI对象
UIDefaults.getUI(javax.swing.JComponent)
public void updateUI()
ListUI属性设置为当前看提供的价值和感觉。如果当前单元格渲染器是由开发商安装(而不是感觉本身),这也导致细胞器和它的孩子被更新,通过它调用
SwingUtilities.updateComponentTreeUI。
public String getUIClassID()
"ListUI",
UIDefaults密钥用于查找定义看
javax.swing.plaf.ListUI类的名字,觉得这个组件。
getUIClassID 方法重写,继承类
JComponent
JComponent.getUIClassID(),
UIDefaults.getUI(javax.swing.JComponent)
public E getPrototypeCellValue()
null如果没有这样的价值。
prototypeCellValue属性的值
setPrototypeCellValue(E)
public void setPrototypeCellValue(E prototypeCellValue)
prototypeCellValue属性,然后(如果新值
non-null),要求的给定值单元格渲染器组件的计算
fixedCellWidth和
fixedCellHeight性质(指数0)从细胞器,和使用该组件的首选大小。
如果列表太长,让ListUI计算每个单元格的宽度/高度,这种方法是有用的,并且有一个单细胞的值是已知的占领任何一个人的空间,一个所谓的原型。
而三的prototypeCellValue,fixedCellHeight,和fixedCellWidth性质可以通过此方法修改,PropertyChangeEvent通知只发送时,prototypeCellValue性质变化。
看,设置此属性的一个例子,看class description以上。
此属性的默认值是null。
这是一个JavaBeans属性绑定。
prototypeCellValue -根据
fixedCellWidth和
fixedCellHeight价值
getPrototypeCellValue(),
setFixedCellWidth(int),
setFixedCellHeight(int),
Container.addPropertyChangeListener(java.beans.PropertyChangeListener)
public int getFixedCellWidth()
fixedCellWidth属性的值。
setFixedCellWidth(int)
public void setFixedCellWidth(int width)
width是1,计算在
ListUI运用
getPreferredSize为每个列表元素的细胞渲染器组件是单元格宽度。
此属性的默认值是-1。
这是一个JavaBeans属性绑定。
width -宽度为列表中的所有细胞
setPrototypeCellValue(E),
setFixedCellWidth(int),
Container.addPropertyChangeListener(java.beans.PropertyChangeListener)
public int getFixedCellHeight()
fixedCellHeight属性的值。
setFixedCellHeight(int)
public void setFixedCellHeight(int height)
height是1,计算在
ListUI运用
getPreferredSize为每个列表元素的细胞是细胞高度渲染器组件。
此属性的默认值是-1。
这是一个JavaBeans属性绑定。
height -高度可用于为列表中的所有细胞
setPrototypeCellValue(E),
setFixedCellWidth(int),
Container.addPropertyChangeListener(java.beans.PropertyChangeListener)
public ListCellRenderer<? super E> getCellRenderer()
cellRenderer属性的值
setCellRenderer(javax.swing.ListCellRenderer<? super E>)
public void setCellRenderer(ListCellRenderer<? super E> cellRenderer)
如果prototypeCellValue属性non-null,设置单元格渲染器也使fixedCellWidth和fixedCellHeight性质的重新计算。只有一个PropertyChangeEvent为cellRenderer财产而产生的。
此属性的默认值是由ListUI代表提供,即通过感官实现。
这是一个JavaBeans属性绑定。
cellRenderer -涂料单细胞
ListCellRenderer
getCellRenderer()
public Color getSelectionForeground()
DefaultListCellRenderer使用这个颜色画在选定的国家项目的前景,最
ListUI实现安装渲染器一样。
setSelectionForeground(java.awt.Color),
DefaultListCellRenderer
public void setSelectionForeground(Color selectionForeground)
DefaultListCellRenderer使用这个颜色画在选定的国家项目的前景,最
ListUI实现安装渲染器一样。
这个属性的默认值是由外观和感觉实现定义的。
这是一个JavaBeans属性绑定。
selectionForeground -
Color使用前景中选择的列表项
getSelectionForeground(),
setSelectionBackground(java.awt.Color),
JComponent.setForeground(java.awt.Color),
JComponent.setBackground(java.awt.Color),
JComponent.setFont(java.awt.Font),
DefaultListCellRenderer
public Color getSelectionBackground()
DefaultListCellRenderer使用这个颜色画在选定的国家项目的背景下,大多数
ListUI实现安装渲染器一样。
setSelectionBackground(java.awt.Color),
DefaultListCellRenderer
public void setSelectionBackground(Color selectionBackground)
DefaultListCellRenderer使用此颜色填充在选定的项目为背景,以实现最
ListUI安装渲染器一样。
这个属性的默认值是由外观和感觉实现定义的。
这是一个JavaBeans属性绑定。
selectionBackground -
Color使用选定的单元格的背景
getSelectionBackground(),
setSelectionForeground(java.awt.Color),
JComponent.setForeground(java.awt.Color),
JComponent.setBackground(java.awt.Color),
JComponent.setFont(java.awt.Font),
DefaultListCellRenderer
public int getVisibleRowCount()
visibleRowCount属性的值。请参见
setVisibleRowCount(int)细节如何解释这个值。
visibleRowCount属性的值。
setVisibleRowCount(int)
public void setVisibleRowCount(int visibleRowCount)
visibleRowCount属性,具有不同的含义,根据不同的布局定位:一
VERTICAL布局定位,这套行的首选号码显示不需要滚动;其他方向,它影响着细胞的包装。
在VERTICAL定位:
设置这个属性影响的getPreferredScrollableViewportSize()方法的返回值,这是用来计算一个封闭视口的首选尺寸。查看更多细节的方法的文档。
在HORIZONTAL_WRAP和VERTICAL_WRAP取向:
这如何影响细胞包裹。更多详情见setLayoutOrientation(int)文档。
此属性的默认值是8。
一个负值的结果在属性被设置为0调用此方法。
这是一个JavaBeans属性绑定。
visibleRowCount -指定要显示不需要滚动的行优先数的整数
getVisibleRowCount(),
getPreferredScrollableViewportSize(),
setLayoutOrientation(int),
JComponent.getVisibleRect(),
JViewport
public int getLayoutOrientation()
VERTICAL如果布局是单柱细胞,
VERTICAL_WRAP如果布局是“报纸”风格与内容垂直然后水平流动,或
HORIZONTAL_WRAP如果布局是“报纸”风格与内容水平再垂直流动。
layoutOrientation属性的值
setLayoutOrientation(int)
public void setLayoutOrientation(int layoutOrientation)
JList。细胞可以被布置在以下几个方面:
垂直:0一二三四horizontal_wrap:0 1 23 4vertical_wrap:0 31 4二
这些布局的描述如下:
Value |
描述 |
|---|---|
VERTICAL |
Cells are layed out vertically in a single column. |
HORIZONTAL_WRAP |
Cells are layed out horizontally, wrapping to a new row as necessary. If the visibleRowCount property is less than or equal to zero, wrapping is determined by the width of the list; otherwise wrapping is done in such a way as to ensure visibleRowCount rows in the list. |
VERTICAL_WRAP |
Cells are layed out vertically, wrapping to a new column as necessary. If the visibleRowCount property is less than or equal to zero, wrapping is determined by the height of the list; otherwise wrapping is done at visibleRowCount rows. |
此属性的默认值是VERTICAL。
layoutOrientation -新的布局方向之一:
VERTICAL,
HORIZONTAL_WRAP或
VERTICAL_WRAP
IllegalArgumentException -如果
layoutOrientation不是一个允许值
getLayoutOrientation(),
setVisibleRowCount(int),
getScrollableTracksViewportHeight(),
getScrollableTracksViewportWidth()
public int getFirstVisibleIndex()
componentOrientation,第一个可见的细胞被发现接近列表的左上角。在右至左方向,它被发现最接近右上角。如果没有看到或列表为空,则返回
-1。请注意,返回的单元格可能只会部分可见。
getLastVisibleIndex(),
JComponent.getVisibleRect()
public int getLastVisibleIndex()
-1。请注意,返回的单元格可能只会部分可见。
getFirstVisibleIndex(),
JComponent.getVisibleRect()
public void ensureIndexIsVisible(int index)
scrollRectToVisible。这种方法的
JList工作,必须在一个
JViewport。
如果给定的索引位于列表的单元格区域之外,这种方法将导致没有结果。
index -细胞可见指数
JComponent.scrollRectToVisible(java.awt.Rectangle),
JComponent.getVisibleRect()
public void setDragEnabled(boolean b)
true,和列表的
TransferHandler需要
non-null。该
dragEnabled属性的默认值是
false。
履行这一性质的工作,并识别用户拖动手势,在外观和感觉的实现,并特别名单的ListUI。当启用自动拖动处理,大多数的外观和感觉(包括那些类BasicLookAndFeel)开始拖放操作时,用户按下鼠标按钮到一个项目,然后将鼠标移动几个像素。将此属性设置为true因此可以有选择的行为有潜移默化的影响。
如果一个外观和感觉的应用,忽略了这个属性,你可以开始拖动和名单上的TransferHandler调用exportAsDrag拖放操作。
b -是否启用自动拖动处理
HeadlessException -如果
b是
true和
GraphicsEnvironment.isHeadless()返回
true
GraphicsEnvironment.isHeadless(),
getDragEnabled(),
JComponent.setTransferHandler(javax.swing.TransferHandler),
TransferHandler
public boolean getDragEnabled()
dragEnabled属性的值
setDragEnabled(boolean)
public final void setDropMode(DropMode dropMode)
DropMode.USE_SELECTION。使用的其他模式之一,建议,但是,对于一个改进的用户体验。
DropMode.ON,例如,提供展示项目选定的类似的行为,但不影响列表中的现实选择。
JList支持以下降模式:
DropMode.USE_SELECTIONDropMode.ONDropMode.INSERTDropMode.ON_OR_INSERTTransferHandler接受滴。
dropMode -下降模式的使用
IllegalArgumentException -如果滴模式不被支持或
null
getDropMode(),
getDropLocation(),
JComponent.setTransferHandler(javax.swing.TransferHandler),
TransferHandler
public final DropMode getDropMode()
setDropMode(javax.swing.DropMode)
public final JList.DropLocation getDropLocation()
null如果没有定位是目前被证明。
这种方法并不意味着查询从一个TransferHandler放置位置,如放置位置设置后,TransferHandler的canImport回来了,已经允许将只显示位置。
这个属性变化时,一个名为“droplocation”是由组件发射属性更改事件。
默认情况下,对于听这个属性的改变和指示放置位置直观地在列表的ListUI责任,这可能把它直接和/或安装一个单元格渲染器这样做。开发商希望实现自定义的放置位置画和/或替换默认的单元格渲染器,可能需要尊重这个属性。
setDropMode(javax.swing.DropMode),
TransferHandler.canImport(TransferHandler.TransferSupport)
public int getNextMatch(String prefix, int startIndex, Position.Bias bias)
toString值从给定的前缀。
prefix -火柴测试字符串
startIndex -开始搜索指数
bias -搜索方向,要么position.bias.forward或position.bias.backward。
-1
IllegalArgumentException如果前缀是
null或startIndex出界
public String getToolTipText(MouseEvent event)
JComponent的
getToolTipText首先检查该事件发生的单元格渲染器组件,返回它的工具提示文本,如果任何。这个实现允许您指定在细胞水平上的工具提示文本,用你的细胞
setToolTipText渲染器组件。
对于JList适当地以这种方式显示其渲染工具提示注:,JList必须注册组件与ToolTipManager。这个注册是在构造函数中自动完成。但是,如果在以后的某个JList是未注册的,通过电话setToolTipText(null),从渲染提示将不再显示。
getToolTipText 方法重写,继承类
JComponent
event -
MouseEvent去取工具提示文本
JComponent.setToolTipText(java.lang.String),
JComponent.getToolTipText()
public int locationToIndex(Point location)
getCellBounds。此方法返回
-1如果模型是空的
这是一个同名的方法列表中的ListUI覆盖法。它返回-1如果列表中没有ListUI。
location -的点的坐标
-1
public Point indexToLocation(int index)
null如果索引无效。
这是一个同名的方法列表中的ListUI覆盖法。它返回null如果列表中没有ListUI。
index -细胞指数
null
public Rectangle getCellBounds(int index0, int index1)
如果小指标是细胞外的列表的范围,此方法返回null。如果较小的索引是有效的,但较大的索引是在列表的范围之外的,只是返回第一个索引的范围。否则,返回有效范围的范围。
这是一个同名的方法列表中的ListUI覆盖法。它返回null如果列表中没有ListUI。
index0 -范围内的第一个指标
index1 -范围内的第二指数
null
public ListModel<E> getModel()
JList组件显示项目列表。
ListModel提供项目显示的列表
setModel(javax.swing.ListModel<E>)
public void setModel(ListModel<E> model)
这是一个JavaBeans属性绑定。
model -
ListModel提供用于显示的项目列表
null
model
IllegalArgumentException
getModel(),
clearSelection()
public void setListData(E[] listData)
ListModel,并调用该模型
setModel。
试图通过一个null值,这种方法的结果是未定义的行为,最有可能的例外。创建的模型直接引用给定的数组。尝试在调用此方法后修改数组的结果,导致未定义的行为。
listData -包含项目列表中显示
E数组
setModel(javax.swing.ListModel<E>)
public void setListData(Vector<? extends E> listData)
Vector只读
ListModel和电话
setModel这个模型。
试图通过一个null值,这种方法的结果是未定义的行为,最有可能的例外。创建的模型给出的Vector直接引用。试图修改Vector后调用该方法的结果是未定义的行为。
listData -
Vector包含项目列表中显示
setModel(javax.swing.ListModel<E>)
protected ListSelectionModel createSelectionModel()
DefaultListSelectionModel实例;称为施工期间初始化列表的选择模型属性。
DefaultListSelecitonModel,用于初始化列表的选择模型的建设
setSelectionModel(javax.swing.ListSelectionModel),
DefaultListSelectionModel
public ListSelectionModel getSelectionModel()
ListSelectionModel
setSelectionModel(javax.swing.ListSelectionModel),
ListSelectionModel
protected void fireSelectionValueChanged(int firstIndex,
int lastIndex,
boolean isAdjusting)
ListSelectionListeners直接添加到了列表选择模型选择的变化。
JList听在选择模型的选择进行了更改,并将通知侦听器添加到列表中直接调用这个方法。
该方法构造了一个ListSelectionEvent这个列表为源,与指定的参数,并将其发送到注册ListSelectionListeners。
firstIndex -范围内的第一个指标,
<= lastIndex
lastIndex -范围内的最后一个索引,
>= firstIndex
isAdjusting -这是否是一个系列的多个事件,那里的变化仍在进行
addListSelectionListener(javax.swing.event.ListSelectionListener),
removeListSelectionListener(javax.swing.event.ListSelectionListener),
ListSelectionEvent,
EventListenerList
public void addListSelectionListener(ListSelectionListener listener)
JList照顾听力内容中的模型选择的状态改变,并通知给每个更改侦听器。
ListSelectionEvents给听者有
source属性设置为该列表。
listener -
ListSelectionListener添加
getSelectionModel(),
getListSelectionListeners()
public void removeListSelectionListener(ListSelectionListener listener)
listener -
ListSelectionListener删除
addListSelectionListener(javax.swing.event.ListSelectionListener),
getSelectionModel()
public ListSelectionListener[] getListSelectionListeners()
ListSelectionListeners数组添加到这个
JList通过
addListSelectionListener。
ListSelectionListeners在此列表中,或一个空数组如果没有听众已添加
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectionModel(ListSelectionModel selectionModel)
null
ListSelectionModel实施
selectionModel。选择模型处理单个选择,连续范围的选择,和非连续的选择的任务。
这是一个JavaBeans属性绑定。
selectionModel -实现选择的
ListSelectionModel
null
selectionModel
IllegalArgumentException
getSelectionModel()
public void setSelectionMode(int selectionMode)
下面的列表描述了所接受的选择模式:
ListSelectionModel.SINGLE_SELECTION -只有一个列表索引一次可以选择。在这种模式下,setSelectionInterval和addSelectionInterval是等效的,取代当前的选择由第二个参数表示的指数(“领导”)。ListSelectionModel.SINGLE_INTERVAL_SELECTION -只有一个连续的时间间隔一次可以选择。在这种模式下,addSelectionInterval像setSelectionInterval(替换当前选择},除非给出的区间是相邻或重叠存在的选择,可以用来种植的选择。ListSelectionModel.MULTIPLE_INTERVAL_SELECTION -在这种模式下,有什么可以选择无限制。此模式为默认值。selectionMode -选择模式
IllegalArgumentException如果选择模式并不是那种允许
getSelectionMode()
public int getSelectionMode()
setSelectionMode(int)
public int getAnchorSelectionIndex()
ListSelectionModel.getAnchorSelectionIndex()
public int getLeadSelectionIndex()
ListSelectionModel.getLeadSelectionIndex()
public int getMinSelectionIndex()
-1如果选择是空的。这是一个覆盖方法,代表在列表的选择模型上的相同名称的方法。
-1
ListSelectionModel.getMinSelectionIndex()
public int getMaxSelectionIndex()
-1如果选择是空的。这是一个覆盖方法,代表在列表的选择模型上的相同名称的方法。
ListSelectionModel.getMaxSelectionIndex()
public boolean isSelectedIndex(int index)
true如果指定的索引选择,其他
false。这是一个覆盖方法,代表在列表的选择模型上的相同名称的方法。
index指数被选择状态
true如果指定的索引选择,其他
false
ListSelectionModel.isSelectedIndex(int),
setSelectedIndex(int)
public boolean isSelectionEmpty()
true如果没有被选中,否则
false。这个名单上的选择模型的同名方法代表覆盖的方法。
true如果没有被选中,否则
false
ListSelectionModel.isSelectionEmpty(),
clearSelection()
public void clearSelection()
isSelectionEmpty将返回
true。这是一个覆盖方法,代表在列表的选择模型上的相同名称的方法。
public void setSelectionInterval(int anchor,
int lead)
anchor和
lead指标包括。
anchor不应小于或等于
lead。这是一个覆盖方法,代表在列表的选择模型上的相同名称的方法。
指的是选择模型被用于对值小于0细节的文档处理。
public void addSelectionInterval(int anchor,
int lead)
anchor和
lead指标包括。
anchor不应小于或等于
lead。这个名单上的选择模型的同名方法代表覆盖的方法。
指的是选择模型被用于对值小于0细节的文档处理。
anchor -添加到选择的第一指标
lead -添加到选择的最后一个索引
ListSelectionModel.addSelectionInterval(int, int),
DefaultListSelectionModel.addSelectionInterval(int, int),
createSelectionModel(),
setSelectionInterval(int, int),
removeSelectionInterval(int, int)
public void removeSelectionInterval(int index0,
int index1)
index0和
index1指标被删除。
index0不应小于或等于
index1。这是一个覆盖方法,代表在列表的选择模型上的相同名称的方法。
指的是选择模型被用于对值小于0处理细节的文件。
index0 -从选择中删除第一指数
index1 -从选择中删除最后一个指标
ListSelectionModel.removeSelectionInterval(int, int),
DefaultListSelectionModel.removeSelectionInterval(int, int),
createSelectionModel(),
setSelectionInterval(int, int),
addSelectionInterval(int, int)
public void setValueIsAdjusting(boolean b)
valueIsAdjusting财产。当
true,选择即将到来的改变应该被视为一个单一的变化部分。此属性在内部使用,而开发人员通常不需要调用此方法。例如,当模型正在响应用户拖动更新,该属性的值设置为
true当拖启动和设置
false当拖完。这允许侦听器更新只有当一个更改已完成,而不是处理所有的中间值。
如果做了一系列的变化,应该被认为是一个单一的变化的一部分,你可能会想使用这个直接。
这是一个覆盖方法,代表在列表的选择模型上的相同名称的方法。看到更多的细节ListSelectionModel.setValueIsAdjusting(boolean)文档。
public boolean getValueIsAdjusting()
isAdjusting属性的值。
这是一个覆盖方法,代表在列表的选择模型上的相同名称的方法。
isAdjusting属性的值。
setValueIsAdjusting(boolean),
ListSelectionModel.getValueIsAdjusting()
public int[] getSelectedIndices()
removeSelectionInterval(int, int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
public void setSelectedIndex(int index)
setSelectionInterval在选择模型。请参阅文档选择模型类用于对值小于
0处理细节。
public void setSelectedIndices(int[] indices)
addSelectionInterval在选择模型添加指标。指的是选择模型被用于对值小于
0细节的文档处理。
indices -细胞的指数选择阵列,
non-null
NullPointerException -如果指定数组是
null
ListSelectionModel.addSelectionInterval(int, int),
isSelectedIndex(int),
addListSelectionListener(javax.swing.event.ListSelectionListener)
@Deprecated public Object[] getSelectedValues()
getSelectedValuesList()
isSelectedIndex(int),
getModel(),
addListSelectionListener(javax.swing.event.ListSelectionListener)
public List<E> getSelectedValuesList()
isSelectedIndex(int),
getModel(),
addListSelectionListener(javax.swing.event.ListSelectionListener)
public int getSelectedIndex()
-1如果没有选择。
该方法是一种覆盖,代表getMinSelectionIndex。
public E getSelectedValue()
null如果没有选择。
这是一个方便的方法,简单地返回getMinSelectionIndex模型的价值。
public void setSelectedValue(Object anObject, boolean shouldScroll)
anObject -选择对象
shouldScroll -
true如果列表滚动显示选择的对象,如果存在;否则
false
public Dimension getPreferredScrollableViewportSize()
visibleRowCount行视口的大小。此方法返回的值取决于布局定位:
VERTICAL:
这是小事如果fixedCellWidth和fixedCellHeight已定(显式或通过指定一个原型单元格值)。宽度是fixedCellWidth加列表的水平吧。高度的fixedCellHeight乘以visibleRowCount,加上垂直插入列表。
如果fixedCellWidth或fixedCellHeight没有指定,使用启发式。如果模型是空的,其宽度是fixedCellWidth,如果大于0,或硬编码的值256。高度的fixedCellHeight乘以visibleRowCount,如果fixedCellHeight大于0,否则是硬编码的值乘以visibleRowCount 16。
如果模型不是空的,宽度是首选的大小的宽度,通常是最宽的列表元素的宽度。高度的fixedCellHeight乘以visibleRowCount,加上垂直插入列表。
VERTICAL_WRAP或HORIZONTAL_WRAP:
这个方法只返回值从getPreferredSize。列表中的ListUI有望覆盖getPreferredSize返回一个适当的值。
getPreferredScrollableViewportSize 接口
Scrollable
visibleRowCount行视口的大小
getPreferredScrollableViewportSize(),
setPrototypeCellValue(E)
public int getScrollableUnitIncrement(Rectangle visibleRect, int orientation, int direction)
水平滚动,如果布局的方向是VERTICAL列表的字体大小,然后返回(或1如果字体是null)。
getScrollableUnitIncrement 接口
Scrollable
visibleRect -视图的视口内的可见区域
orientation -
SwingConstants.HORIZONTAL或
SwingConstants.VERTICAL
direction -小于或等于零的滚动/后,大于零的失望了
IllegalArgumentException -如果
visibleRect是
null,或
orientation不是一个
SwingConstants.VERTICAL或
SwingConstants.HORIZONTAL
getScrollableBlockIncrement(java.awt.Rectangle, int, int),
Scrollable.getScrollableUnitIncrement(java.awt.Rectangle, int, int)
public int getScrollableBlockIncrement(Rectangle visibleRect, int orientation, int direction)
对于垂直滚动,使用以下规则:
visibleRect.height如果列表为空水平滚动,当布局的方向是VERTICAL_WRAP或HORIZONTAL_WRAP:
visibleRect.width如果列表为空水平滚动和VERTICAL取向,返回visibleRect.width。
注意,visibleRect的值必须this.getVisibleRect()平等。
getScrollableBlockIncrement 接口
Scrollable
visibleRect -视图的视口内的可见区域
orientation -
SwingConstants.HORIZONTAL或
SwingConstants.VERTICAL
direction -小于或等于零的滚动/后,大于零的失望了
IllegalArgumentException -如果
visibleRect是
null,或
orientation不是一个
SwingConstants.VERTICAL或
SwingConstants.HORIZONTAL
getScrollableUnitIncrement(java.awt.Rectangle, int, int),
Scrollable.getScrollableBlockIncrement(java.awt.Rectangle, int, int)
public boolean getScrollableTracksViewportWidth()
true如果这
JList在
JViewport和视口显示比列表的首选宽度更宽,或如果布局的方向是
HORIZONTAL_WRAP和
visibleRowCount <= 0;否则返回
false。
如果false,然后不要跟踪视口的宽度。这允许水平滚动条,如果JViewport本身是嵌入在一个JScrollPane。
getScrollableTracksViewportWidth 接口
Scrollable
Scrollable.getScrollableTracksViewportWidth()
public boolean getScrollableTracksViewportHeight()
true如果这
JList在
JViewport和视口显示比列表的首选高度更高,或者如果布局的方向是
VERTICAL_WRAP和
visibleRowCount <= 0;否则返回
false。
如果false,然后不要跟踪视图的高度。这允许垂直滚动,如果JViewport本身是嵌入在一个JScrollPane。
getScrollableTracksViewportHeight 接口
Scrollable
Scrollable.getScrollableTracksViewportHeight()
protected String paramString()
JList一
String表示。这种方法的目的是用于调试目的,其含量和返回的
String格式不同的实现可能会有所不同。返回的
String可能是空的,但不可能
null。
paramString 方法重写,继承类
JComponent
String表示
JList。
public AccessibleContext getAccessibleContext()
AccessibleContext
JList。对于
JList的
AccessibleContext,需要一个
AccessibleJList
一个新的AccessibleJList实例被创建时。
getAccessibleContext 接口
Accessible
getAccessibleContext 方法重写,继承类
Component
AccessibleJList作为本
JList的
AccessibleContext
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.