Exemple #1
0
  /**
   * Compute the bounds of the <code>Lite</code> objets.
   *
   * @return The bounding rectangle.
   */
  public Rectangle getBounds() {
    if (lites.isEmpty()) return new Rectangle();

    Enumeration e = elements();
    Lite l = (Lite) e.nextElement();
    Rectangle r = l.getBounds();
    while (e.hasMoreElements()) {
      l = (Lite) e.nextElement();
      r.add(l.getBounds());
    }
    return r;
  }
Exemple #2
0
 /**
  * Retrieve the <code>Lite</code> object visible under a point. This object should actually be
  * searched in reverse order in the <code>Lite</code> object list.
  */
 public Lite itemUnder(int x, int y) {
   for (int i = lites.size() - 1; i >= 0; i--) {
     Lite l = elementAt(i);
     if (l.getBounds().contains(x, y)) return l;
   }
   return null;
 }