KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > javax > swing > plaf > ListUI


1 /*
2  * @(#)ListUI.java 1.12 03/12/19
3  *
4  * Copyright 2004 Sun Microsystems, Inc. All rights reserved.
5  * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
6  */

7
8 package javax.swing.plaf;
9
10 import javax.swing.JList JavaDoc;
11 import java.awt.Point JavaDoc;
12 import java.awt.Rectangle JavaDoc;
13
14
15 /**
16  * The JList pluggable look and feel delegate. This interface adds
17  * methods that allow the JList component to map locations, e.g. mouse
18  * coordinates, to list cells and from cell indices to the bounds of
19  * the cell.
20  *
21  * @version 1.12 12/19/03
22  * @author Hans Muller
23  */

24
25 public abstract class ListUI extends ComponentUI JavaDoc
26 {
27     /**
28      * Convert a point in <code>JList</code> coordinates to the closest index
29      * of the cell at that location. To determine if the cell actually
30      * contains the specified location use a combination of this method and
31      * <code>getCellBounds</code>. Returns -1 if the model is empty.
32      *
33      * @param location The JList relative coordinates of the cell
34      * @return The index of the cell at location, or -1.
35      */

36     public abstract int locationToIndex(JList JavaDoc list, Point JavaDoc location);
37
38
39     /**
40      * Returns the origin of the specified item in JList
41      * coordinates, null if index isn't valid.
42      *
43      * @param index The index of the JList cell.
44      * @return The origin of the index'th cell.
45      */

46     public abstract Point JavaDoc indexToLocation(JList JavaDoc list, int index);
47
48
49     /**
50      * Returns the bounds of the specified item in JList
51      * coordinates, null if index isn't valid.
52      *
53      * @param index The index of the JList cell.
54      * @return The bounds of the index'th cell.
55      */

56     public abstract Rectangle JavaDoc getCellBounds(JList JavaDoc list, int index1, int index2);
57 }
58
Popular Tags