- java.lang.Object
-
- javax.swing.plaf.ComponentUI
-
- javax.swing.plaf.ListUI
-
- Direct Known Subclasses:
- BasicListUI, MultiListUI
public abstract class ListUI extends ComponentUI
TheJList
pluggable look and feel delegate.
-
-
Constructor Summary
Constructors Constructor and Description ListUI()
-
Method Summary
Methods 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 givenJList
, of the specified item, in the list's coordinate system.abstract int
locationToIndex(JList list, Point location)
Returns the cell index in the specifiedJList
closest to the given location in the list's coordinate system.-
Methods inherited from class javax.swing.plaf.ComponentUI
contains, createUI, getAccessibleChild, getAccessibleChildrenCount, getBaseline, getBaselineResizeBehavior, getMaximumSize, getMinimumSize, getPreferredSize, installUI, paint, uninstallUI, update
-
-
-
-
Method Detail
-
locationToIndex
public abstract int locationToIndex(JList list, Point location)
Returns the cell index in the specifiedJList
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 bygetCellBounds
. This method returns-1
if the list's model is empty.- Parameters:
list
- the listlocation
- 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)
Returns the origin in the givenJList
, of the specified item, in the list's coordinate system. Returnsnull
if the index isn't valid.- Parameters:
list
- the listindex
- the cell index- Returns:
- the origin of the cell, or
null
-
getCellBounds
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
- the listindex1
- the first index in the rangeindex2
- the second index in the range- Returns:
- the bounding rectangle for the range of cells, or
null
-
-
Document created the 11/06/2005, last modified the 04/03/2020
Source of the printed document:https://www.gaudry.be/en/java-api-rf-javax/swing/plaf/ListUI.html
The infobrol is a personal site whose content is my sole responsibility. The text is available under CreativeCommons license (BY-NC-SA). More info on the terms of use and the author.
References
These references and links indicate documents consulted during the writing of this page, or which may provide additional information, but the authors of these sources can not be held responsible for the content of this page.
The author This site is solely responsible for the way in which the various concepts, and the freedoms that are taken with the reference works, are presented here. Remember that you must cross multiple source information to reduce the risk of errors.