Top Description Constructors Methods
javax.swing.plaf

public abstract Class ListUI

extends ComponentUI
Class Inheritance
Known Direct Subclasses
javax.swing.plaf.basic.BasicListUI, javax.swing.plaf.multi.MultiListUI
Imports
javax.swing.JList, java.awt.Point, .Rectangle

The JList pluggable look and feel delegate.
Author
Hans Muller

Constructor Summary

AccessConstructor and Description
protected
ListUI()

Constructor for subclasses to call.

Method Summary

Modifier and TypeMethod and Description
public abstract Rectangle

Returns:

the bounding rectangle for the range of cells, or null
getCellBounds
(JList<?>
the list
list
,
int
the first index in the range
index1
,
int
the second index in the range
index2
)

Returns the bounding rectangle, in the given list's coordinate system, for the range of cells specified by the two indices.

public abstract Point

Returns:

the origin of the cell, or null
indexToLocation
(JList<?>
the list
list
,
int
the cell index
index
)

Returns the origin in the given JList, of the specified item, in the list's coordinate system.

public abstract int

Returns:

the cell index closest to the given location, or -1
locationToIndex
(JList<?>
the list
list
,
Point
the coordinates of the point
location
)

Returns the cell index in the specified JList closest to the given location in the list's coordinate system.

Inherited from javax.swing.plaf.ComponentUI:
containscreateUIgetAccessibleChildgetAccessibleChildrenCountgetBaselinegetBaselineResizeBehaviorgetMaximumSizegetMinimumSizegetPreferredSizeinstallUIpaintuninstallUIupdate

Constructor Detail

ListUIback to summary
protected ListUI()

Constructor for subclasses to call.

Method Detail

getCellBoundsback to summary
public abstract Rectangle getCellBounds(JList<?> list, int index1, int index2)

Returns the bounding rectangle, in the given list's coordinate system, for the range of cells specified by the two indices. The indices can be supplied in any order.

If the smaller index is outside the list's range of cells, this method returns null. If the smaller index is valid, but the larger index is outside the list's range, the bounds of just the first index is returned. Otherwise, the bounds of the valid range is returned.

Parameters
list:JList<?>

the list

index1:int

the first index in the range

index2:int

the second index in the range

Returns:Rectangle

the bounding rectangle for the range of cells, or null

indexToLocationback to summary
public abstract Point indexToLocation(JList<?> list, int index)

Returns the origin in the given JList, of the specified item, in the list's coordinate system. Returns null if the index isn't valid.

Parameters
list:JList<?>

the list

index:int

the cell index

Returns:Point

the origin of the cell, or null

locationToIndexback to summary
public abstract int locationToIndex(JList<?> list, Point location)

Returns the cell index in the specified JList closest to the given location in the list's coordinate system. To determine if the cell actually contains the specified location, compare the point against the cell's bounds, as provided by getCellBounds. This method returns -1 if the list's model is empty.

Parameters
list:JList<?>

the list

location:Point

the coordinates of the point

Returns:int

the cell index closest to the given location, or -1

Exceptions
NullPointerException:
if location is null