edu.rit.draw.item
Class OutlinedItem
- java.lang.Object
-
- edu.rit.draw.item.DrawingItem
-
- edu.rit.draw.item.OutlinedItem
-
- All Implemented Interfaces:
- java.io.Externalizable, java.io.Serializable
- Direct Known Subclasses:
- Arc, Bow, FilledItem, Line
public abstract class OutlinedItem extends DrawingItem implements java.io.Externalizable
Class OutlinedItem is the abstract base class for a DrawingItem that has an outline. Specify Outline.NONE for the outline to omit drawing a drawing item's outline.The static defaultOutline() method is provided to set the default outline. If the outline is not specified, the current default outline is used.
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field and Description static OutlineNORMAL_OUTLINEThe normal outline: Solid, square corners, 1 point wide, black.
-
Constructor Summary
Constructors Constructor and Description OutlinedItem()Construct a new outlined item with the default outline.OutlinedItem(OutlinedItem theItem)Construct a new outlined item with the same outline as the given outlined item.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method and Description OutlinedItemadd()Add this outlined item to the end of the default drawing's sequence of drawing items.OutlinedItemadd(Drawing theDrawing)Add this outlined item to the end of the given drawing's sequence of drawing items.OutlinedItemaddFirst()Add this outlined item to the beginning of the default drawing's sequence of drawing items.OutlinedItemaddFirst(Drawing theDrawing)Add this outlined item to the beginning of the given drawing's sequence of drawing items.static OutlinedefaultOutline()Returns the default outline.static voiddefaultOutline(Outline theOutline)Set the default outline.Outlineoutline()Returns this outlined item's outline.OutlinedItemoutline(Outline theOutline)Set this outlined item's outline.voidreadExternal(java.io.ObjectInput in)Read this outlined item from the given object input stream.voidwriteExternal(java.io.ObjectOutput out)Write this outlined item to the given object output stream.
-
-
-
Field Detail
-
NORMAL_OUTLINE
public static final Outline NORMAL_OUTLINE
The normal outline: Solid, square corners, 1 point wide, black.
-
-
Constructor Detail
-
OutlinedItem
public OutlinedItem()
Construct a new outlined item with the default outline.
-
OutlinedItem
public OutlinedItem(OutlinedItem theItem)
Construct a new outlined item with the same outline as the given outlined item.- Parameters:
theItem- Outlined item.- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theItem is null.
-
-
Method Detail
-
defaultOutline
public static Outline defaultOutline()
Returns the default outline.- Returns:
- Default outline, or Outline.NONE.
-
defaultOutline
public static void defaultOutline(Outline theOutline)
Set the default outline. Before calling this method the first time, the default outline is solid, square corners, 1 point wide, black.- Parameters:
theOutline- Default outline, or Outline.NONE.
-
outline
public Outline outline()
Returns this outlined item's outline.- Returns:
- Outline, or Outline.NONE.
-
outline
public OutlinedItem outline(Outline theOutline)
Set this outlined item's outline.- Parameters:
theOutline- Outline, or Outline.NONE.- Returns:
- This outlined item.
-
add
public OutlinedItem add()
Add this outlined item to the end of the default drawing's sequence of drawing items.- Overrides:
addin classDrawingItem- Returns:
- This outlined item.
- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if there is no default drawing.- See Also:
Drawing.defaultDrawing()
-
add
public OutlinedItem add(Drawing theDrawing)
Add this outlined item to the end of the given drawing's sequence of drawing items.- Overrides:
addin classDrawingItem- Parameters:
theDrawing- Drawing.- Returns:
- This outlined item.
- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if theDrawing is null.
-
addFirst
public OutlinedItem addFirst()
Add this outlined item to the beginning of the default drawing's sequence of drawing items.- Overrides:
addFirstin classDrawingItem- Returns:
- This outlined item.
- Throws:
java.lang.NullPointerException- (unchecked exception) Thrown if there is no default drawing.- See Also:
Drawing.defaultDrawing()
-
addFirst
public OutlinedItem addFirst(Drawing theDrawing)
Add this outlined item to the beginning of the given drawing's sequence of drawing items.- Overrides:
addFirstin classDrawingItem- Parameters:
theDrawing- Drawing.- Returns:
- This outlined 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 outlined item to the given object output stream.- Specified by:
writeExternalin interfacejava.io.Externalizable- Overrides:
writeExternalin classDrawingItem- 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 outlined item from the given object input stream.- Specified by:
readExternalin interfacejava.io.Externalizable- Overrides:
readExternalin classDrawingItem- 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 outlined item cannot be found.
-
-
DMelt 3.0 © DataMelt by jWork.ORG