|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectedu.rit.draw.item.DrawingItem
edu.rit.draw.item.Text
public class Text
Class Text provides a textual DrawingItem. A text item has these attributes:
Class Text supports a subset of HTML for specifying attributes of characters. The following HTML tags may be embedded in the text:
To get literal less-than, greater-than, and ampersand characters in the text, use the following HTML character entities:
| Nested Class Summary | |
|---|---|
static class |
Text.Alignment
Enumeration Text.Alignment specifies the alignment of multiple lines in a Text item. |
| Field Summary | |
|---|---|
static Text.Alignment |
NORMAL_ALIGNMENT
The normal alignment (left). |
static Bullet |
NORMAL_BULLET
The normal bullet (none). |
static Fill |
NORMAL_FILL
The normal fill paint (black). |
static Font |
NORMAL_FONT
The normal font (sanserif, plain, 12 point). |
static double |
NORMAL_SPACING
The normal line spacing factor (7/6). |
| Constructor Summary | |
|---|---|
Text()
Construct a new text item. |
|
Text(Text theItem)
Construct a new text item with the same text, location, and attributes as the given text item. |
|
| Method Summary | |
|---|---|
Text |
add()
Add this text item to the end of the default drawing's sequence of drawing items. |
Text |
add(Drawing theDrawing)
Add this text item to the end of the given drawing's sequence of drawing items. |
Text |
addFirst()
Add this text item to the beginning of the default drawing's sequence of drawing items. |
Text |
addFirst(Drawing theDrawing)
Add this text item to the beginning of the given drawing's sequence of drawing items. |
Text.Alignment |
align()
Returns this text item's text alignment. |
Text |
align(Text.Alignment theAlignment)
Set this text item's text alignment. |
Bullet |
bullet()
Returns this text item's bullet. |
Text |
bullet(Bullet theBullet)
Set this text item's bullet. |
Text |
c(double x,
double y)
Set the center point of this text item's bounding box. |
Text |
c(Point thePoint)
Set the center point of this text item's bounding box. |
static Text.Alignment |
defaultAlign()
Returns the default text alignment. |
static void |
defaultAlign(Text.Alignment theAlignment)
Set the default text alignment. |
static Bullet |
defaultBullet()
Returns the default bullet. |
static void |
defaultBullet(Bullet theBullet)
Set the default bullet. |
static Fill |
defaultFill()
Returns the default fill paint. |
static void |
defaultFill(Fill theFill)
Set the default fill paint. |
static Font |
defaultFont()
Returns the default font. |
static void |
defaultFont(Font theFont)
Set the default font. |
static double |
defaultSpacing()
Returns the default line spacing factor. |
static void |
defaultSpacing(double theSpacing)
Set the default line spacing factor. |
void |
draw(Graphics2D g2d)
Draw this text item in the given graphics context. |
Text |
e(double x,
double y)
Set the east middle point of this text item's bounding box. |
Text |
e(Point thePoint)
Set the east middle point of this text item's bounding box. |
Fill |
fill()
Returns this text item's fill paint. |
Text |
fill(Fill theFill)
Set this text item's fill paint. |
Font |
font()
Returns this text item's font. |
Text |
font(Font theFont)
Set this text item's font. |
double |
height()
Returns the height of this text item's bounding box. |
Text |
n(double x,
double y)
Set the north middle point of this text item's bounding box. |
Text |
n(Point thePoint)
Set the north middle point of this text item's bounding box. |
Text |
ne(double x,
double y)
Set the northeast corner point of this text item's bounding box. |
Text |
ne(Point thePoint)
Set the northeast corner point of this text item's bounding box. |
Point |
nw()
Returns the northwest corner point of this text item's bounding box. |
Text |
nw(double x,
double y)
Set the northwest corner point of this text item's bounding box. |
Text |
nw(Point thePoint)
Set the northwest corner point of this text item's bounding box. |
void |
readExternal(ObjectInput in)
Read this text item from the given object input stream. |
Text |
s(double x,
double y)
Set the south middle point of this text item's bounding box. |
Text |
s(Point thePoint)
Set the south middle point of this text item's bounding box. |
Text |
se(double x,
double y)
Set the southeast corner point of this text item's bounding box. |
Text |
se(Point thePoint)
Set the southeast corner point of this text item's bounding box. |
double |
spacing()
Returns this text item's line spacing factor. |
Text |
spacing(double theSpacing)
Set this text item's line spacing factor. |
Text |
sw(double x,
double y)
Set the southwest corner point of this text item's bounding box. |
Text |
sw(Point thePoint)
Set the southwest corner point of this text item's bounding box. |
String |
text()
Returns this text item's text. |
Text |
text(String theText)
Set this text item's text. |
Text |
w(double x,
double y)
Set the west middle point of this text item's bounding box. |
Text |
w(Point thePoint)
Set the west middle point of this text item's bounding box. |
double |
width()
Returns the width of this text item's bounding box. |
void |
writeExternal(ObjectOutput out)
Write this text item to the given object output stream. |
| Methods inherited from class edu.rit.draw.item.DrawingItem |
|---|
boundingBox, c, e, n, ne, s, se, size, sw, w |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
public static final Font NORMAL_FONT
public static final Fill NORMAL_FILL
public static final double NORMAL_SPACING
public static final Text.Alignment NORMAL_ALIGNMENT
public static final Bullet NORMAL_BULLET
| Constructor Detail |
|---|
public Text()
public Text(Text theItem)
theItem - Text item.
NullPointerException - (unchecked exception) Thrown if theItem is null.| Method Detail |
|---|
public static Font defaultFont()
public static void defaultFont(Font theFont)
theFont - Default font.
NullPointerException - (unchecked exception) Thrown if theFont is null.public static Fill defaultFill()
public static void defaultFill(Fill theFill)
theFill - Default fill paint.
NullPointerException - (unchecked exception) Thrown if theFill is null.public static double defaultSpacing()
public static void defaultSpacing(double theSpacing)
theSpacing - Default line spacing factor.
IllegalArgumentException - (unchecked exception) Thrown if theSpacing is less than 0.public static Text.Alignment defaultAlign()
public static void defaultAlign(Text.Alignment theAlignment)
theAlignment - Default text alignment.
NullPointerException - (unchecked exception) Thrown if theAlignment is null.public static Bullet defaultBullet()
public static void defaultBullet(Bullet theBullet)
theBullet - Default bullet.public String text()
public Text text(String theText)
theText - Text (may be null).
public Font font()
public Text font(Font theFont)
theFont - Font.
NullPointerException - (unchecked exception) Thrown if theFont is null.public Fill fill()
public Text fill(Fill theFill)
theFill - Fill paint.
NullPointerException - (unchecked exception) Thrown if theFill is null.public double spacing()
public Text spacing(double theSpacing)
theSpacing - Line spacing factor.
IllegalArgumentException - (unchecked exception) Thrown if theSpacing is less than 0.public Text.Alignment align()
public Text align(Text.Alignment theAlignment)
theAlignment - Text alignment.
NullPointerException - (unchecked exception) Thrown if theAlignment is null.public Bullet bullet()
public Text bullet(Bullet theBullet)
theBullet - Default bullet.
public double width()
width in class DrawingItempublic double height()
height in class DrawingItempublic Point nw()
nw in class DrawingItem
public Text nw(double x,
double y)
x - X coordinate of northwest corner point.y - Y coordinate of northwest corner point.
public Text nw(Point thePoint)
thePoint - Northwest corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Text n(double x,
double y)
x - X coordinate of north middle point.y - Y coordinate of north middle point.
public Text n(Point thePoint)
thePoint - North middle point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Text ne(double x,
double y)
x - X coordinate of northeast corner point.y - Y coordinate of northeast corner point.
public Text ne(Point thePoint)
thePoint - Northeast corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Text w(double x,
double y)
x - X coordinate of west middle point.y - Y coordinate of west middle point.
public Text w(Point thePoint)
thePoint - West middle point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Text c(double x,
double y)
x - X coordinate of center point.y - Y coordinate of center point.
public Text c(Point thePoint)
thePoint - Center point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Text e(double x,
double y)
x - X coordinate of east middle point.y - Y coordinate of east middle point.
public Text e(Point thePoint)
thePoint - East middle point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Text sw(double x,
double y)
x - X coordinate of southwest corner point.y - Y coordinate of southwest corner point.
public Text sw(Point thePoint)
thePoint - Southwest corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Text s(double x,
double y)
x - X coordinate of south middle point.y - Y coordinate of south middle point.
public Text s(Point thePoint)
thePoint - South middle point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.
public Text se(double x,
double y)
x - X coordinate of southeast corner point.y - Y coordinate of southeast corner point.
public Text se(Point thePoint)
thePoint - Southeast corner point.
NullPointerException - (unchecked exception) Thrown if thePoint is null.public Text add()
add in class DrawingItemNullPointerException - (unchecked exception) Thrown if there is no default drawing.Drawing.defaultDrawing()public Text add(Drawing theDrawing)
add in class DrawingItemtheDrawing - Drawing.
NullPointerException - (unchecked exception) Thrown if theDrawing is null.public Text addFirst()
addFirst in class DrawingItemNullPointerException - (unchecked exception) Thrown if there is no default drawing.Drawing.defaultDrawing()public Text addFirst(Drawing theDrawing)
addFirst in class DrawingItemtheDrawing - Drawing.
NullPointerException - (unchecked exception) Thrown if theDrawing is null.
public void writeExternal(ObjectOutput out)
throws IOException
writeExternal in interface ExternalizablewriteExternal in class DrawingItemout - Object output stream.
IOException - Thrown if an I/O error occurred.
public void readExternal(ObjectInput in)
throws IOException,
ClassNotFoundException
readExternal in interface ExternalizablereadExternal in class DrawingItemin - Object input stream.
IOException - Thrown if an I/O error occurred.
ClassNotFoundException - Thrown if any class needed to deserialize this text item cannot be
found.public void draw(Graphics2D g2d)
draw in class DrawingItemg2d - 2-D graphics context.
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||