Beispiel #1
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;
 }
Beispiel #2
0
 /**
  * Paint each <code>Lite</code> object in turn after testing if it is inside the clip of the
  * Graphics. This is the right way to do it if the repainting time of <code>Lite</code> objects is
  * much greater than the time required to compute its bounds.
  *
  * @see excentric.LiteGroup#paintAll(java.awt.Graphics)
  */
 public void paint(Graphics g) {
   Rectangle clip = g.getClipBounds();
   for (Enumeration e = lites.elements(); e.hasMoreElements(); ) {
     Lite l = (Lite) e.nextElement();
     // if (l.getBounds().intersects(clip))
     l.paint(g);
   }
 }
Beispiel #3
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;
  }
Beispiel #4
0
 /**
  * Paint each <code>Lite</code> object .
  *
  * @see excentric.LiteGroup#paint(java.awt.Graphics)
  */
 public void paintAll(Graphics g) {
   for (Enumeration e = lites.elements(); e.hasMoreElements(); ) {
     Lite l = (Lite) e.nextElement();
     l.paint(g);
   }
 }
Beispiel #5
0
 /**
  * Sets the position of each of the <code>Lite</code> objects to the specified Point.
  *
  * @param p The new position point.
  */
 public void setPosition(Point p) {
   for (Enumeration e = lites.elements(); e.hasMoreElements(); ) {
     Lite l = (Lite) e.nextElement();
     l.setPosition(p);
   }
 }