javax.swing.plaf
Class ListUI

java.lang.Object
  extended by javax.swing.plaf.ComponentUI
      extended by javax.swing.plaf.ListUI
Direct Known Subclasses:
BasicListUI, MultiListUI

public abstract class ListUI
extends ComponentUI

An abstract base class for delegates that implement the pluggable look and feel for a JList.


Constructor Summary
ListUI()
          Constructs a new ListUI.
 
Method Summary
abstract  Rectangle getCellBounds(JList list, int index1, int index2)
          Determines the bounding box of the rectangle spanned by two list indices.
abstract  Point indexToLocation(JList list, int index)
          Determines the location of the specified cell.
abstract  int locationToIndex(JList list, Point location)
          Determines the cell index which is the closest to the specified location.
 
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ListUI

public ListUI()
Constructs a new ListUI.

Method Detail

locationToIndex

public abstract int locationToIndex(JList list,
                                    Point location)
Determines the cell index which is the closest to the specified location. The find out whether the returned cell actually contains the location, the caller should also use getCellBounds(javax.swing.JList, int, int).

Parameters:
list - the JList for which this delegate object provides the pluggable user interface.
location - a point in the JList coordinate system.
Returns:
the index of the closest cell, or -1 if the list model is empty.

indexToLocation

public abstract Point indexToLocation(JList list,
                                      int index)
Determines the location of the specified cell.

Parameters:
list - the JList for which this delegate object provides the pluggable user interface.
index - the zero-based index of the cell whose location shall be determined.
Returns:
the position of the top left corner of the cell in the JList coordinate system, or null if cell does not designate a valid cell.

getCellBounds

public abstract Rectangle getCellBounds(JList list,
                                        int index1,
                                        int index2)
Determines the bounding box of the rectangle spanned by two list indices.

Parameters:
list - the JList for which this delegate object provides the pluggable user interface.
index1 - the zero-based index of the first cell.
index2 - the zero-based index of the second cell.
Returns:
the spanned rectangle, or null if either index1 or index2 does not designate a valid cell.