1. /*
  2. * @(#)ListUI.java 1.8 00/02/02
  3. *
  4. * Copyright 1997-2000 Sun Microsystems, Inc. All Rights Reserved.
  5. *
  6. * This software is the proprietary information of Sun Microsystems, Inc.
  7. * Use is subject to license terms.
  8. *
  9. */
  10. package javax.swing.plaf;
  11. import javax.swing.JList;
  12. import java.awt.Point;
  13. import java.awt.Rectangle;
  14. /**
  15. * The JList pluggable look and feel delegate. This interface adds
  16. * methods that allow the JList component to map locations, e.g. mouse
  17. * coordinates, to list cells and from cell indices to the bounds of
  18. * the cell.
  19. *
  20. * @version 1.8 02/02/00
  21. * @author Hans Muller
  22. */
  23. public abstract class ListUI extends ComponentUI
  24. {
  25. /**
  26. * Convert a point in JList coordinates to the index
  27. * of the cell at that location. Returns -1 if there's no
  28. * cell the specified location.
  29. *
  30. * @param location The JList relative coordinates of the cell
  31. * @return The index of the cell at location, or -1.
  32. */
  33. public abstract int locationToIndex(JList list, Point location);
  34. /**
  35. * Returns the origin of the specified item in JList
  36. * coordinates, null if index isn't valid.
  37. *
  38. * @param index The index of the JList cell.
  39. * @return The origin of the index'th cell.
  40. */
  41. public abstract Point indexToLocation(JList list, int index);
  42. /**
  43. * Returns the bounds of the specified item in JList
  44. * coordinates, null if index isn't valid.
  45. *
  46. * @param index The index of the JList cell.
  47. * @return The bounds of the index'th cell.
  48. */
  49. public abstract Rectangle getCellBounds(JList list, int index1, int index2);
  50. }