Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

Copyright © 2006 Sun Microsystems, Inc. All rights reserved.

JSR-209 (Final Approval Ballot)

javax.microedition.plaf
Interface ListUI


public interface ListUI

The JList pluggable look and feel delegate. This interface adds methods that allow the JList component to map locations, e.g. mouse coordinates, to list cells and from cell indices to the bounds of the cell.


Method Summary
 Rectangle getCellBounds(JList list, int index0, int index1)
          Returns the bounds of the specified item in JList coordinates, null if index isn't valid.
 Point indexToLocation(JList list, int index)
          Returns the origin of the specified item in JList coordinates, null if index isn't valid.
 int locationToIndex(JList list, Point location)
          Convert a point in JList coordinates to the closest index of the cell at that location.
 

Method Detail

locationToIndex

public int locationToIndex(JList list,
                           Point location)
Convert a point in JList coordinates to the closest index of the cell at that location. To determine if the cell actually contains the specified location use a combination of this method and getCellBounds. Returns -1 if the model is empty.

Parameters:
location - The JList relative coordinates of the cell
Returns:
The index of the cell at location, or -1.

indexToLocation

public Point indexToLocation(JList list,
                             int index)
Returns the origin of the specified item in JList coordinates, null if index isn't valid.

Parameters:
index - The index of the JList cell.
Returns:
The origin of the index'th cell.

getCellBounds

public Rectangle getCellBounds(JList list,
                               int index0,
                               int index1)
Returns the bounds of the specified item in JList coordinates, null if index isn't valid.

Parameters:
index0 - - the index of the first JList cell in the range
index1 - - the index of the last JList cell in the range
Returns:
The bounds of the index'th cell.

JSR-209 (Final Approval Ballot)

Copyright © 2006 Sun Microsystems, Inc. All rights reserved. Use is subject to License Terms. Your use of this web site or any of its content or software indicates your agreement to be bound by these License Terms.

For more information, please consult the JSR 209 specification.