Class PaintedList

  • All Implemented Interfaces:
    PaintedObject

    public class PaintedList
    extends java.lang.Object
    implements PaintedObject
    A class that collects a number of PaintedObjects. This is a low-level utility class intended for constructing graphical objects from some kind of external list.
    Version:
    $Id$
    Author:
    John Reekie
    • Field Summary

      Fields 
      Modifier and Type Field Description
      java.util.ArrayList paintedObjects
      The list of PaintedObjects
    • Constructor Summary

      Constructors 
      Constructor Description
      PaintedList()  
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void add​(PaintedObject po)
      Add a new element to the list.
      java.awt.geom.Rectangle2D getBounds()
      Get the bounding box of the list of painted objects.
      void paint​(java.awt.Graphics2D g)
      Paint the list of objects.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • paintedObjects

        public java.util.ArrayList paintedObjects
        The list of PaintedObjects
    • Constructor Detail

      • PaintedList

        public PaintedList()
    • Method Detail

      • add

        public void add​(PaintedObject po)
        Add a new element to the list. The element is added to the back of the list, and so will be painted over the top of the elements already in the list.
      • getBounds

        public java.awt.geom.Rectangle2D getBounds()
        Get the bounding box of the list of painted objects. Clients should cache the bounding box if performance is important.
        Specified by:
        getBounds in interface PaintedObject
      • paint

        public void paint​(java.awt.Graphics2D g)
        Paint the list of objects. Objects are painted from the front of the list backwards.
        Specified by:
        paint in interface PaintedObject