1. /*
  2. * @(#)ListUI.java 1.11 03/01/23
  3. *
  4. * Copyright 2003 Sun Microsystems, Inc. All rights reserved.
  5. * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms.
  6. */
  7. package javax.swing.plaf;
  8. import javax.swing.JList;
  9. import java.awt.Point;
  10. import java.awt.Rectangle;
  11. /**
  12. * The JList pluggable look and feel delegate. This interface adds
  13. * methods that allow the JList component to map locations, e.g. mouse
  14. * coordinates, to list cells and from cell indices to the bounds of
  15. * the cell.
  16. *
  17. * @version 1.11 01/23/03
  18. * @author Hans Muller
  19. */
  20. public abstract class ListUI extends ComponentUI
  21. {
  22. /**
  23. * Convert a point in <code>JList</code> coordinates to the closest index
  24. * of the cell at that location. To determine if the cell actually
  25. * contains the specified location use a combination of this method and
  26. * <code>getCellBounds</code>. Returns -1 if the model is empty.
  27. *
  28. * @param location The JList relative coordinates of the cell
  29. * @return The index of the cell at location, or -1.
  30. */
  31. public abstract int locationToIndex(JList list, Point location);
  32. /**
  33. * Returns the origin of the specified item in JList
  34. * coordinates, null if index isn't valid.
  35. *
  36. * @param index The index of the JList cell.
  37. * @return The origin of the index'th cell.
  38. */
  39. public abstract Point indexToLocation(JList list, int index);
  40. /**
  41. * Returns the bounds of the specified item in JList
  42. * coordinates, null if index isn't valid.
  43. *
  44. * @param index The index of the JList cell.
  45. * @return The bounds of the index'th cell.
  46. */
  47. public abstract Rectangle getCellBounds(JList list, int index1, int index2);
  48. }