edu.rit.swing
Class DisplayableList
- java.lang.Object
-
- edu.rit.swing.DisplayableList
-
- All Implemented Interfaces:
- Displayable, Drawable
public class DisplayableList extends java.lang.Object implements Displayable
Class DisplayableList provides an object that combines a list of separateDisplayableobjects into a single displayable object.Note: Class DisplayableList is multiple thread safe.
-
-
Constructor Summary
Constructors Constructor and Description DisplayableList()Construct a new, empty displayable list.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidadd(Displayable theDisplayable)Add the given displayable object to the end of this displayable list.voidclear()Clear this displayable list.voiddraw(java.awt.Graphics2D g2d)Draw this drawable object in the given graphics context.java.awt.PaintgetBackgroundPaint()Returns this displayable object's background paint.java.awt.geom.Rectangle2DgetBoundingBox()Returns this displayable object's bounding box.
-
-
-
Constructor Detail
-
DisplayableList
public DisplayableList()
Construct a new, empty displayable list.
-
-
Method Detail
-
clear
public void clear()
Clear this displayable list.
-
add
public void add(Displayable theDisplayable)
Add the given displayable object to the end of this displayable list.- Parameters:
theDisplayable- Displayable object.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theDisplayable is null.
-
draw
public void draw(java.awt.Graphics2D g2d)
Draw this drawable object in the given graphics context. Upon return from this method, the given graphics context's state (color, font, transform, clip, and so on) is the same as it was upon entry to this method.The displayable objects in this displayable list are drawn in the order they were added.
-
getBoundingBox
public java.awt.geom.Rectangle2D getBoundingBox()
Returns this displayable object's bounding box. This is the smallest rectangle that encloses all of this displayable object.This method returns the union of the bounding boxes of the displayable objects in this displayable list. If this displayable list is empty, an empty rectangle is returned.
- Specified by:
getBoundingBoxin interfaceDisplayable
-
getBackgroundPaint
public java.awt.Paint getBackgroundPaint()
Returns this displayable object's background paint.This method returns the background paint of the first displayable object in this displayable list. If this displayable list is empty, the color white is returned.
- Specified by:
getBackgroundPaintin interfaceDisplayable
-
-
DMelt 3.0 © DataMelt by jWork.ORG