public abstract class ListUI extends ComponentUI
JList
pluggable look and feel delegate.Constructor and Description |
---|
ListUI() |
Modifier and Type | Method and Description |
---|---|
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.
|
abstract Point |
indexToLocation(JList list,
int index)
Returns the origin in the given
JList , of the specified item,
in the list's coordinate system. |
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. |
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
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.list
- the listlocation
- the coordinates of the point-1
NullPointerException
- if location
is nullpublic 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.list
- the listindex
- the cell indexnull
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.
list
- the listindex1
- the first index in the rangeindex2
- the second index in the rangenull
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2023, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.