edu.rit.draw.item
Class FilledItem
- java.lang.Object
-
- edu.rit.draw.item.DrawingItem
-
- edu.rit.draw.item.OutlinedItem
-
- edu.rit.draw.item.FilledItem
-
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable
- Direct Known Subclasses:
- ShapeItem
public abstract class FilledItem extends OutlinedItem implements java.io.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
Fields Modifier and Type Field and Description static FillNORMAL_FILLThe normal fill paint: White.-
Fields inherited from class edu.rit.draw.item.OutlinedItem
NORMAL_OUTLINE
-
-
Constructor Summary
Constructors Constructor and Description 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
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description FilledItemadd()Add this filled item to the end of the default drawing's sequence of drawing items.FilledItemadd(Drawing theDrawing)Add this filled item to the end of the given drawing's sequence of drawing items.FilledItemaddFirst()Add this filled item to the beginning of the default drawing's sequence of drawing items.FilledItemaddFirst(Drawing theDrawing)Add this filled item to the beginning of the given drawing's sequence of drawing items.static FilldefaultFill()Returns the default fill paint.static voiddefaultFill(Fill theFill)Set the default fill paint.Fillfill()Returns this filled item's fill paint.FilledItemfill(Fill theFill)Set this filled item's fill paint.FilledItemoutline(Outline theOutline)Set this filled item's outline.voidreadExternal(java.io.ObjectInput in)Read this filled item from the given object input stream.voidwriteExternal(java.io.ObjectOutput out)Write this filled item to the given object output stream.-
Methods inherited from class edu.rit.draw.item.OutlinedItem
defaultOutline, defaultOutline, outline
-
-
-
-
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:
java.lang.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:
outlinein classOutlinedItem- 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:
addin classOutlinedItem- Returns:
- This filled item.
- Throws:
java.lang.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:
addin classOutlinedItem- Parameters:
theDrawing- Drawing.- Returns:
- This filled item.
- Throws:
java.lang.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:
addFirstin classOutlinedItem- Returns:
- This filled item.
- Throws:
java.lang.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:
addFirstin classOutlinedItem- Parameters:
theDrawing- Drawing.- Returns:
- This filled item.
- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theDrawing is null.
-
writeExternal
public void writeExternal(java.io.ObjectOutput out) throws java.io.IOExceptionWrite this filled item to the given object output stream.- Specified by:
writeExternalin interfacejava.io.Externalizable- Overrides:
writeExternalin classOutlinedItem- Parameters:
out- Object output stream.- Throws:
java.io.IOException- Thrown if an I/O error occurred.
-
readExternal
public void readExternal(java.io.ObjectInput in) throws java.io.IOException, java.lang.ClassNotFoundExceptionRead this filled item from the given object input stream.- Specified by:
readExternalin interfacejava.io.Externalizable- Overrides:
readExternalin classOutlinedItem- Parameters:
in- Object input stream.- Throws:
java.io.IOException- Thrown if an I/O error occurred.java.lang.ClassNotFoundException- Thrown if any class needed to deserialize this filled item cannot be found.
-
-
DMelt 3.0 © DataMelt by jWork.ORG