Class Text
java.lang.Object
com.motivewave.platform.sdk.draw.Text
- All Implemented Interfaces:
Cloneable
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionadjustFont(Font f) Adjusts the font of the text while retaining the current line layout.clone()voidcompact()Compresses the bounds to fit exactly the size of the text as per the last call to layout()booleancontains(double x, double y) voiddestroy()voiddraw(Graphics2D gc) Draws the text within the given bounds.doublegetAngle()Gets the background color for the outline.Gets the border color.getFont()Gets the font for displaying the text.doublegetImage()Gets the image to display next to the text.Gets the text insets.getLines()Gets the lines of text (text separated by newlines or word wrap)intintdoublegetMaxX()doublegetMaxY()getText()Gets the text to display when drawing this object.Gets the text color.doublegetWidth()doublegetX()doublegetY()booleanbooleanIndicates if the border should be shown around the text.booleanIndicates if the outline of the text should be drawn.booleanvoidlayout()Layout the text using the internal widthvoidlayout(int maxWidth) Layout the text using the internal widthvoidvoidsetAngle(double radians) voidsetBackground(Color color) Sets the background color for the outline.voidsetBGColor1(Color c) voidsetBGColor2(Color c) voidsetBorderColor(Color color) Sets the color for the border of the text.voidsetBorderStroke(BasicStroke stroke) Sets the stroke for the border line.voidvoidsetBounds(double x, double y, double width, double height) voidsetCenter(double x, double y) voidvoidvoidSets the font to use when drawing the text.voidsetHAlign(Enums.TextAlign align) Sets the horizontal alignment.voidvoidsetHighlighted(boolean b) voidSets an image to display with the text.voidsetInsets(int top, int left, int bottom, int right) Sets the insets for the text.voidsetLocation(double x, double y) voidvoidsetMaxLines(int max) voidsetOutline(Enums.TextOutline outline) voidsetShowBorder(boolean b) Sets the show border attribute for the text.voidsetShowOutline(boolean b) Sets the attribute for drawing the outline.voidSets the text to display when drawing this object.voidsetTextColor(Color color) Sets the text color.voidsetVAlign(Enums.TextAlign align) Sets the vertical alignment.voidsetVisible(boolean b) Sets the visible.
-
Constructor Details
-
Text
public Text()Constructor. Creates a Text object with default properties -
Text
Constructor. Creates a Text object with default properties -
Text
-
Text
-
Text
-
-
Method Details
-
destroy
public void destroy() -
draw
Draws the text within the given bounds.- Parameters:
gc- graphics context
-
getMaxLines
public int getMaxLines() -
setMaxLines
public void setMaxLines(int max) -
getText
-
setText
Sets the text to display when drawing this object. Newlines may be inserted into this text by adding newline characters (ie '\n').- Parameters:
text- text to display
-
setFont
-
getFont
Gets the font for displaying the text. -
setBorderColor
Sets the color for the border of the text.- Parameters:
color- border color
-
getBorderColor
-
setBorderStroke
Sets the stroke for the border line.- Parameters:
stroke- border stroke
-
setShowOutline
public void setShowOutline(boolean b) Sets the attribute for drawing the outline.- Parameters:
b- true if the outline should be drawn
-
isShowOutline
public boolean isShowOutline()Indicates if the outline of the text should be drawn.- Returns:
- true if the outline should be drawn
-
setShowBorder
public void setShowBorder(boolean b) Sets the show border attribute for the text.- Parameters:
b- true if the border should be drawn
-
isShowBorder
public boolean isShowBorder()Indicates if the border should be shown around the text.- Returns:
- true if the border should be drawn
-
setBackground
Sets the background color for the outline. Use 'null' if the background should not be drawn.- Parameters:
color- background color
-
getBackground
Gets the background color for the outline.- Returns:
- background color for the text (null if no background)
-
setBGColor1
-
getBGColor1
-
setBGColor2
-
getBGColor2
-
setTextColor
-
getTextColor
-
setHAlign
Sets the horizontal alignment.- Parameters:
align- horizontal alignment
-
setVAlign
Sets the vertical alignment.- Parameters:
align- vertical alignment
-
getInsets
Gets the text insets. -
setInsets
public void setInsets(int top, int left, int bottom, int right) Sets the insets for the text.- Parameters:
top- top insetleft- left insetbottom- bottom insetright- right inset
-
setVisible
public void setVisible(boolean b) Sets the visible.- Parameters:
b- true if the text is visible
-
isVisible
public boolean isVisible()- Returns:
- true if the text is visible.
-
setImage
-
getImage
Gets the image to display next to the text.- Returns:
- image displayed next to the text
-
getLines
-
setDisplayFont
-
getDisplayFont
-
adjustFont
Adjusts the font of the text while retaining the current line layout.- Returns:
- new dimensions of the text
-
layout
public void layout()Layout the text using the internal width -
getMaxWidth
public int getMaxWidth() -
layout
public void layout(int maxWidth) Layout the text using the internal width -
compact
public void compact()Compresses the bounds to fit exactly the size of the text as per the last call to layout() -
layout
-
contains
public boolean contains(double x, double y) -
getBounds
-
getOutline
-
setHighlighted
public void setHighlighted(boolean b) -
isHighlighted
public boolean isHighlighted() -
setBounds
public void setBounds(double x, double y, double width, double height) -
getBorderStroke
-
setBorderStroke
-
setLocation
-
setLocation
public void setLocation(double x, double y) -
setCenter
-
setCenter
public void setCenter(double x, double y) -
setHandle
-
getHandle
-
getY
public double getY() -
getX
public double getX() -
getHeight
public double getHeight() -
getWidth
public double getWidth() -
getMaxY
public double getMaxY() -
getMaxX
public double getMaxX() -
getCenter
-
getLocation
-
setAngle
public void setAngle(double radians) -
getAngle
public double getAngle() -
setOutline
-
clone
-