edu.rit.draw.item
Class FilledItem

java.lang.Object
  extended by edu.rit.draw.item.DrawingItem
      extended by edu.rit.draw.item.OutlinedItem
          extended by edu.rit.draw.item.FilledItem
All Implemented Interfaces:
Externalizable, Serializable
Direct Known Subclasses:
ShapeItem

public abstract class FilledItem
extends OutlinedItem
implements Externalizable

Class FilledItem is the abstract base class for a DrawingItem that has an outline and is filled with a paint. Specify Fill.NONE for the fill paint to omit filling a drawing item's interior.

The static defaultFill() method is provided to set the default fill paint. If the fill paint is not specified, the current default fill paint is used.

See Also:
Serialized Form

Field Summary
static Fill NORMAL_FILL
          The normal fill paint: White.
 
Fields inherited from class edu.rit.draw.item.OutlinedItem
NORMAL_OUTLINE
 
Constructor Summary
FilledItem()
          Construct a new filled item with the default fill paint.
FilledItem(FilledItem theItem)
          Construct a new filled item with the same outline and fill paint as the given filled item.
 
Method Summary
 FilledItem add()
          Add this filled item to the end of the default drawing's sequence of drawing items.
 FilledItem add(Drawing theDrawing)
          Add this filled item to the end of the given drawing's sequence of drawing items.
 FilledItem addFirst()
          Add this filled item to the beginning of the default drawing's sequence of drawing items.
 FilledItem addFirst(Drawing theDrawing)
          Add this filled item to the beginning of the given drawing's sequence of drawing items.
static Fill defaultFill()
          Returns the default fill paint.
static void defaultFill(Fill theFill)
          Set the default fill paint.
 Fill fill()
          Returns this filled item's fill paint.
 FilledItem fill(Fill theFill)
          Set this filled item's fill paint.
 FilledItem outline(Outline theOutline)
          Set this filled item's outline.
 void readExternal(ObjectInput in)
          Read this filled item from the given object input stream.
 void writeExternal(ObjectOutput out)
          Write this filled item to the given object output stream.
 
Methods inherited from class edu.rit.draw.item.OutlinedItem
defaultOutline, defaultOutline, outline
 
Methods inherited from class edu.rit.draw.item.DrawingItem
boundingBox, c, draw, e, height, n, ne, nw, s, se, size, sw, w, width
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NORMAL_FILL

public static final Fill NORMAL_FILL
The normal fill paint: White.

Constructor Detail

FilledItem

public FilledItem()
Construct a new filled item with the default fill paint.


FilledItem

public FilledItem(FilledItem theItem)
Construct a new filled item with the same outline and fill paint as the given filled item.

Parameters:
theItem - Filled item.
Throws:
NullPointerException - (unchecked exception) Thrown if theItem is null.
Method Detail

defaultFill

public static Fill defaultFill()
Returns the default fill paint.

Returns:
Default fill paint, or Fill.NONE.

defaultFill

public static void defaultFill(Fill theFill)
Set the default fill paint. Before calling this method the first time, the default fill paint is white.

Parameters:
theFill - Default fill paint, or Fill.NONE.

outline

public FilledItem outline(Outline theOutline)
Set this filled item's outline.

Overrides:
outline in class OutlinedItem
Parameters:
theOutline - Outline, or Outline.NONE.
Returns:
This filled item.

fill

public Fill fill()
Returns this filled item's fill paint.

Returns:
Fill paint, or Fill.NONE.

fill

public FilledItem fill(Fill theFill)
Set this filled item's fill paint.

Parameters:
theFill - Fill paint, or Fill.NONE.
Returns:
This filled item.

add

public FilledItem add()
Add this filled item to the end of the default drawing's sequence of drawing items.

Overrides:
add in class OutlinedItem
Returns:
This filled item.
Throws:
NullPointerException - (unchecked exception) Thrown if there is no default drawing.
See Also:
Drawing.defaultDrawing()

add

public FilledItem add(Drawing theDrawing)
Add this filled item to the end of the given drawing's sequence of drawing items.

Overrides:
add in class OutlinedItem
Parameters:
theDrawing - Drawing.
Returns:
This filled item.
Throws:
NullPointerException - (unchecked exception) Thrown if theDrawing is null.

addFirst

public FilledItem addFirst()
Add this filled item to the beginning of the default drawing's sequence of drawing items.

Overrides:
addFirst in class OutlinedItem
Returns:
This filled item.
Throws:
NullPointerException - (unchecked exception) Thrown if there is no default drawing.
See Also:
Drawing.defaultDrawing()

addFirst

public FilledItem addFirst(Drawing theDrawing)
Add this filled item to the beginning of the given drawing's sequence of drawing items.

Overrides:
addFirst in class OutlinedItem
Parameters:
theDrawing - Drawing.
Returns:
This filled item.
Throws:
NullPointerException - (unchecked exception) Thrown if theDrawing is null.

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
Write this filled item to the given object output stream.

Specified by:
writeExternal in interface Externalizable
Overrides:
writeExternal in class OutlinedItem
Parameters:
out - Object output stream.
Throws:
IOException - Thrown if an I/O error occurred.

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
Read this filled item from the given object input stream.

Specified by:
readExternal in interface Externalizable
Overrides:
readExternal in class OutlinedItem
Parameters:
in - Object input stream.
Throws:
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if any class needed to deserialize this filled item cannot be found.


Copyright © 2005-2012 by Alan Kaminsky. All rights reserved. Send comments to ark­@­cs.rit.edu.