JavaTM 2 Platform
Standard Ed. 6

javax.swing.plaf
类 ListUI

java.lang.Object
  继承者 javax.swing.plaf.ComponentUI
      继承者 javax.swing.plaf.ListUI
直接已知子类:
BasicListUI, MultiListUI

public abstract class ListUI
extends ComponentUI

JList 的可插入外观代理。


构造方法摘要
ListUI()
           
 
方法摘要
abstract  Rectangle getCellBounds(JList list, int index1, int index2)
          返回给定列表坐标系统中的有界矩形,单元的范围由两个索引指定。
abstract  Point indexToLocation(JList list, int index)
          返回列表坐标系统中给定 JList 中指定项的原点。
abstract  int locationToIndex(JList list, Point location)
          返回指定 JList 中与列表坐标系统中给定位置最接近的单元索引。
 
从类 javax.swing.plaf.ComponentUI 继承的方法
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
 
从类 java.lang.Object 继承的方法
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

构造方法详细信息

ListUI

public ListUI()
方法详细信息

locationToIndex

public abstract int locationToIndex(JList list,
                                    Point location)
返回指定 JList 中与列表坐标系统中给定位置最接近的单元索引。要确定该单元是否真正包含指定位置,可比较该点与单元的边界,单元的边界通过 getCellBounds 提供。如果列表的模式为空,则此方法返回 -1

参数:
list - 列表
location - 点的坐标
返回:
与给定位置最接近的单元索引或 -1
抛出:
NullPointerException - 如果 location 为 null

indexToLocation

public abstract Point indexToLocation(JList list,
                                      int index)
返回列表坐标系统中给定 JList 中指定项的原点。如果索引无效,则返回 null

参数:
list - 列表
index - 单元索引
返回:
单元的原点或 null

getCellBounds

public abstract Rectangle getCellBounds(JList list,
                                        int index1,
                                        int index2)
返回给定列表坐标系统中的有界矩形,单元的范围由两个索引指定。可以按任意顺序提供索引。

如果较小索引超出单元的列表范围,则此方法返回 null。如果较小索引有效,但较大索引超出列表范围,则只返回第一个索引的边界。否则,返回有效范围的边界。

参数:
list - 列表
index1 - 范围内第一个索引
index2 - 范围内第二个索引
返回:
单元范围的有界矩形或 null

JavaTM 2 Platform
Standard Ed. 6

提交错误或意见
有关更多的 API 参考资料和开发人员文档,请参阅 Java 2 SDK SE 开发人员文档。该文档包含更详细的、面向开发人员的描述,以及总体概述、术语定义、使用技巧和工作代码示例。

版权所有 2004 Sun Microsystems, Inc. 保留所有权利。 请遵守许可证条款。另请参阅文档重新分发政策