1. /*
  2. * @(#)ListUI.java 1.7 01/11/29
  3. *
  4. * Copyright 2002 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.7 11/29/01
  18. * @author Hans Muller
  19. */
  20. public abstract class ListUI extends ComponentUI
  21. {
  22. /**
  23. * Convert a point in JList coordinates to the index
  24. * of the cell at that location. Returns -1 if there's no
  25. * cell the specified location.
  26. *
  27. * @param location The JList relative coordinates of the cell
  28. * @return The index of the cell at location, or -1.
  29. */
  30. public abstract int locationToIndex(JList list, Point location);
  31. /**
  32. * Returns the origin of the specified item in JList
  33. * coordinates, null if index isn't valid.
  34. *
  35. * @param index The index of the JList cell.
  36. * @return The origin of the index'th cell.
  37. */
  38. public abstract Point indexToLocation(JList list, int index);
  39. /**
  40. * Returns the bounds 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 bounds of the index'th cell.
  45. */
  46. public abstract Rectangle getCellBounds(JList list, int index1, int index2);
  47. }