src/share/classes/javax/swing/plaf/ListUI.java

Print this page




  33 /**
  34  * The {@code JList} pluggable look and feel delegate.
  35  *
  36  * @author Hans Muller
  37  */
  38 
  39 public abstract class ListUI extends ComponentUI
  40 {
  41     /**
  42      * Returns the cell index in the specified {@code JList} closest to the
  43      * given location in the list's coordinate system. To determine if the
  44      * cell actually contains the specified location, compare the point against
  45      * the cell's bounds, as provided by {@code getCellBounds}.
  46      * This method returns {@code -1} if the list's model is empty.
  47      *
  48      * @param list the list
  49      * @param location the coordinates of the point
  50      * @return the cell index closest to the given location, or {@code -1}
  51      * @throws NullPointerException if {@code location} is null
  52      */
  53     public abstract int locationToIndex(JList list, Point location);
  54 
  55 
  56     /**
  57      * Returns the origin in the given {@code JList}, of the specified item,
  58      * in the list's coordinate system.
  59      * Returns {@code null} if the index isn't valid.
  60      *
  61      * @param list the list
  62      * @param index the cell index
  63      * @return the origin of the cell, or {@code null}
  64      */
  65     public abstract Point indexToLocation(JList list, int index);
  66 
  67 
  68     /**
  69      * Returns the bounding rectangle, in the given list's coordinate system,
  70      * for the range of cells specified by the two indices.
  71      * The indices can be supplied in any order.
  72      * <p>
  73      * If the smaller index is outside the list's range of cells, this method
  74      * returns {@code null}. If the smaller index is valid, but the larger
  75      * index is outside the list's range, the bounds of just the first index
  76      * is returned. Otherwise, the bounds of the valid range is returned.
  77      *
  78      * @param list the list
  79      * @param index1 the first index in the range
  80      * @param index2 the second index in the range
  81      * @return the bounding rectangle for the range of cells, or {@code null}
  82      */
  83     public abstract Rectangle getCellBounds(JList list, int index1, int index2);
  84 }


  33 /**
  34  * The {@code JList} pluggable look and feel delegate.
  35  *
  36  * @author Hans Muller
  37  */
  38 
  39 public abstract class ListUI extends ComponentUI
  40 {
  41     /**
  42      * Returns the cell index in the specified {@code JList} closest to the
  43      * given location in the list's coordinate system. To determine if the
  44      * cell actually contains the specified location, compare the point against
  45      * the cell's bounds, as provided by {@code getCellBounds}.
  46      * This method returns {@code -1} if the list's model is empty.
  47      *
  48      * @param list the list
  49      * @param location the coordinates of the point
  50      * @return the cell index closest to the given location, or {@code -1}
  51      * @throws NullPointerException if {@code location} is null
  52      */
  53     public abstract int locationToIndex(JList<?> list, Point location);
  54 
  55 
  56     /**
  57      * Returns the origin in the given {@code JList}, of the specified item,
  58      * in the list's coordinate system.
  59      * Returns {@code null} if the index isn't valid.
  60      *
  61      * @param list the list
  62      * @param index the cell index
  63      * @return the origin of the cell, or {@code null}
  64      */
  65     public abstract Point indexToLocation(JList<?> list, int index);
  66 
  67 
  68     /**
  69      * Returns the bounding rectangle, in the given list's coordinate system,
  70      * for the range of cells specified by the two indices.
  71      * The indices can be supplied in any order.
  72      * <p>
  73      * If the smaller index is outside the list's range of cells, this method
  74      * returns {@code null}. If the smaller index is valid, but the larger
  75      * index is outside the list's range, the bounds of just the first index
  76      * is returned. Otherwise, the bounds of the valid range is returned.
  77      *
  78      * @param list the list
  79      * @param index1 the first index in the range
  80      * @param index2 the second index in the range
  81      * @return the bounding rectangle for the range of cells, or {@code null}
  82      */
  83     public abstract Rectangle getCellBounds(JList<?> list, int index1, int index2);
  84 }