public class Text
extends java.lang.Object
implements java.lang.Cloneable
Constructor and Description |
---|
Text()
Constructor.
|
Text(java.lang.String text)
Constructor.
|
Text(java.lang.String txt,
java.awt.Font f)
Constructor.
|
Text(java.lang.String txt,
java.awt.Font font,
java.awt.Insets insets,
boolean showBox)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.awt.geom.Rectangle2D |
adjustFont(java.awt.Font f)
Adjusts the font of the text while retaining the current line layout.
|
Text |
clone() |
void |
compact()
Compresses the bounds to fit exactly the size of the text as per the last call to layout()
|
boolean |
contains(double x,
double y) |
void |
destroy() |
void |
draw(java.awt.Graphics2D gc)
Draws the text within the given bounds.
|
double |
getAngle() |
java.awt.Color |
getBackground()
Gets the background color for the outline.
|
java.awt.Color |
getBGColor1() |
java.awt.Color |
getBGColor2() |
java.awt.Color |
getBorderColor()
Gets the border color.
|
java.awt.Stroke |
getBorderStroke() |
java.awt.geom.Rectangle2D |
getBounds() |
java.awt.geom.Point2D |
getCenter() |
java.awt.Font |
getDisplayFont() |
java.awt.Font |
getFont()
Gets the font for displaying the text.
|
double |
getHeight() |
java.awt.Image |
getImage() |
java.awt.Insets |
getInsets()
Gets the text insets.
|
java.util.List<java.lang.String> |
getLines() |
java.awt.geom.Point2D |
getLocation() |
double |
getMaxX() |
double |
getMaxY() |
java.awt.Shape |
getOutline() |
java.lang.String |
getText()
Gets the text to display when drawing this object.
|
java.awt.Color |
getTextColor()
Gets the text color.
|
double |
getWidth() |
double |
getX() |
double |
getY() |
boolean |
isHighlighted() |
boolean |
isShowBorder()
Indicates if the border should be shown around the text.
|
boolean |
isShowOutline()
Indicates if the outline of the text should be drawn.
|
boolean |
isVisible() |
void |
layout()
Layout the text using the internal width
|
void |
layout(int maxWidth)
Layout the text using the internal width
|
void |
layout(int width,
java.awt.Font f) |
void |
setAngle(double radians) |
void |
setBackground(java.awt.Color color)
Sets the background color for the outline.
|
void |
setBGColor1(java.awt.Color c) |
void |
setBGColor2(java.awt.Color c) |
void |
setBorderColor(java.awt.Color color)
Sets the color for the border of the text.
|
void |
setBorderStroke(java.awt.BasicStroke stroke)
Sets the stroke for the border line.
|
void |
setBorderStroke(java.awt.Stroke s) |
void |
setBounds(double x,
double y,
double width,
double height) |
void |
setCenter(double x,
double y) |
void |
setCenter(java.awt.geom.Point2D p) |
void |
setDisplayFont(java.awt.Font f) |
void |
setFont(java.awt.Font font)
Sets the font to use when drawing the text.
|
void |
setHAlign(Enums.TextAlign align)
Sets the horizontal alignment.
|
void |
setHighlighted(boolean b) |
void |
setImage(java.awt.Image img)
Sets an image to display with the text.
|
void |
setInsets(int top,
int left,
int bottom,
int right)
Sets the insets for the text.
|
void |
setLocation(double x,
double y) |
void |
setLocation(java.awt.geom.Point2D p) |
void |
setOutline(Enums.TextOutline outline) |
void |
setShowBorder(boolean b)
Sets the show border attribute for the text.
|
void |
setShowOutline(boolean b)
Sets the attribute for drawing the outline.
|
void |
setText(java.lang.String text)
Sets the text to display when drawing this object.
|
void |
setTextColor(java.awt.Color color)
Sets the text color.
|
void |
setVAlign(Enums.TextAlign align)
Sets the vertical alignment.
|
void |
setVisible(boolean b)
Sets the visible.
|
public Text()
public Text(java.lang.String text)
public Text(java.lang.String txt, java.awt.Font f)
txt
- f
- public Text(java.lang.String txt, java.awt.Font font, java.awt.Insets insets, boolean showBox)
txt
- font
- insets
- showBox
- public void destroy()
public void draw(java.awt.Graphics2D gc)
gc
- graphics contextpublic java.lang.String getText()
public void setText(java.lang.String text)
text
- text to displaypublic void setFont(java.awt.Font font)
font
- fontpublic java.awt.Font getFont()
public void setBorderColor(java.awt.Color color)
color
- border colorpublic java.awt.Color getBorderColor()
public void setBorderStroke(java.awt.BasicStroke stroke)
stroke
- border strokepublic void setShowOutline(boolean b)
b
- true if the outline should be drawnpublic boolean isShowOutline()
public void setShowBorder(boolean b)
b
- true if the border should be drawnpublic boolean isShowBorder()
public void setBackground(java.awt.Color color)
color
- background colorpublic java.awt.Color getBackground()
public void setBGColor1(java.awt.Color c)
public java.awt.Color getBGColor1()
public void setBGColor2(java.awt.Color c)
public java.awt.Color getBGColor2()
public void setTextColor(java.awt.Color color)
color
- color of the textpublic java.awt.Color getTextColor()
public void setHAlign(Enums.TextAlign align)
align
- horizontal alignmentpublic void setVAlign(Enums.TextAlign align)
align
- vertical alignmentpublic java.awt.Insets getInsets()
public void setInsets(int top, int left, int bottom, int right)
top
- top insetleft
- left insetbottom
- bottom insetright
- right insetpublic void setVisible(boolean b)
b
- true if the text is visiblepublic boolean isVisible()
public void setImage(java.awt.Image img)
img
- imagepublic java.awt.Image getImage()
public java.util.List<java.lang.String> getLines()
public void setDisplayFont(java.awt.Font f)
public java.awt.Font getDisplayFont()
public java.awt.geom.Rectangle2D adjustFont(java.awt.Font f)
public void layout()
public void layout(int maxWidth)
public void compact()
public void layout(int width, java.awt.Font f)
public boolean contains(double x, double y)
public java.awt.geom.Rectangle2D getBounds()
public java.awt.Shape getOutline()
public void setHighlighted(boolean b)
public boolean isHighlighted()
public void setBounds(double x, double y, double width, double height)
public java.awt.Stroke getBorderStroke()
public void setBorderStroke(java.awt.Stroke s)
public void setLocation(java.awt.geom.Point2D p)
public void setLocation(double x, double y)
public void setCenter(java.awt.geom.Point2D p)
public void setCenter(double x, double y)
public double getY()
public double getX()
public double getHeight()
public double getWidth()
public double getMaxY()
public double getMaxX()
public java.awt.geom.Point2D getCenter()
public java.awt.geom.Point2D getLocation()
public void setAngle(double radians)
public double getAngle()
public void setOutline(Enums.TextOutline outline)
public Text clone()
clone
in class java.lang.Object