com.fullspan.util.swing
Class SwingUtil

java.lang.Object
  extended bycom.fullspan.util.swing.SwingUtil

public class SwingUtil
extends java.lang.Object

Static utility methods for Swing user interfaces (this class has a private constructor and cannot be instantiated).

Version:
$Revision: 1.3 $, $Date: 2004/11/20 08:14:05 $
Author:
Mitch Stuart

Method Summary
static int getClickLocationIndex(javax.swing.JList list, int x, int y)
          Returns the index of the list element at the given location in the list, or -1 if the location does not correspond to a list item.
static java.lang.Object getClickLocationNode(javax.swing.JList list, int x, int y)
          Returns the object at the given location in the list, or null if the location does not correspond to a list item.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getClickLocationNode

public static java.lang.Object getClickLocationNode(javax.swing.JList list,
                                                    int x,
                                                    int y)
Returns the object at the given location in the list, or null if the location does not correspond to a list item. Useful for getting the object that the user clicked on.

Parameters:
list - the list in which to look for the object
x - the x coordinate
y - the y coordinate
Returns:
the object at the given (x,y) coordinate in the list, or null if there is no object at the location

getClickLocationIndex

public static int getClickLocationIndex(javax.swing.JList list,
                                        int x,
                                        int y)
Returns the index of the list element at the given location in the list, or -1 if the location does not correspond to a list item. Useful for getting the index of the element that the user clicked on.

Parameters:
list - the list in which to look for the object
x - the x coordinate
y - the y coordinate
Returns:
the index at the given (x,y) coordinate in the list, or -1 if there is no list element at the location