java.lang.Object
javax.swing.plaf.ComponentUI
javax.swing.plaf.ListUI
- 直接已知的子类:
-
BasicListUI,MultiListUI
JList 可插拔的外观委托。
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionabstract RectanglegetCellBounds(JList<?> list, int index1, int index2) 返回由两个索引指定的单元格范围的边界矩形,在给定列表的坐标系中。abstract PointindexToLocation(JList<?> list, int index) 返回指定项目在给定JList中的原点,在列表的坐标系中。abstract intlocationToIndex(JList<?> list, Point location) 返回在指定JList中距离列表坐标系中给定位置最近的单元格索引。Methods declared in class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
-
Constructor Details
-
ListUI
protected ListUI()子类调用的构造函数。
-
-
Method Details
-
locationToIndex
返回在指定JList中距离列表坐标系中给定位置最近的单元格索引。要确定单元格是否实际包含指定的位置,请将该点与单元格的边界进行比较,如getCellBounds提供的那样。如果列表的模型为空,则此方法返回-1。- 参数:
-
list- 列表 -
location- 点的坐标 - 返回:
-
最接近给定位置的单元格索引,或
-1 - 抛出:
-
NullPointerException- 如果location为 null
-
indexToLocation
返回指定项目在给定JList中的原点,在列表的坐标系中。如果索引无效,则返回null。- 参数:
-
list- 列表 -
index- 单元格索引 - 返回:
-
单元格的原点,或
null
-
getCellBounds
返回由两个索引指定的单元格范围的边界矩形,在给定列表的坐标系中。可以以任何顺序提供索引。如果较小的索引在列表的单元格范围之外,此方法将返回
null。如果较小的索引有效,但较大的索引超出列表的范围,则仅返回第一个索引的边界。否则,返回有效范围的边界。- 参数:
-
list- 列表 -
index1- 范围中的第一个索引 -
index2- 范围中的第二个索引 - 返回:
-
单元格范围的边界矩形,或
null
-