Class ListUI
- Direct Known Subclasses:
-
BasicListUI
,MultiListUI
public abstract class ListUI extends ComponentUI
JList
pluggable look and feel delegate.Constructor Summary
Modifier | Constructor | Description |
---|---|---|
protected |
Constructor for subclasses to call. |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
abstract Rectangle |
getCellBounds |
Returns the bounding rectangle, in the given list's coordinate system, for the range of cells specified by the two indices. |
abstract Point |
indexToLocation |
Returns the origin in the given JList , of the specified item, in the list's coordinate system. |
abstract int |
locationToIndex |
Returns the cell index in the specified JList closest to the given location in the list's coordinate system. |
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
public abstract int locationToIndex(JList<?> list, Point location)
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
- the list -
location
- the coordinates of the point - Returns:
- the cell index closest to the given location, or
-1
- Throws:
-
NullPointerException
- iflocation
is null
indexToLocation
public abstract Point indexToLocation(JList<?> list, int index)
JList
, of the specified item, in the list's coordinate system. Returns null
if the index isn't valid.- Parameters:
-
list
- the list -
index
- the cell index - Returns:
- the origin of the cell, or
null
getCellBounds
public abstract Rectangle getCellBounds(JList<?> list, int index1, int index2)
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
- the list -
index1
- the first index in the range -
index2
- the second index in the range - Returns:
- the bounding rectangle for the range of cells, or
null
© 1993, 2021, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
https://docs.oracle.com/en/java/javase/17/docs/api/java.desktop/javax/swing/plaf/ListUI.html