Package com.dkt.graphics.elements
Class GString
java.lang.Object
com.dkt.graphics.elements.GraphicE
com.dkt.graphics.elements.GString
- All Implemented Interfaces:
Cloneable
- Author:
- Federico Vera <[email protected]>
-
Field Summary
-
Constructor Summary
ConstructorDescriptionGString constructorComplete GString constructorGString constructorGString constructorCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionclone()
void
draw
(Graphics2D g) Draws the component on the given graphicsboolean
double
getAngle()
Retrieves the angle in degrees of theString
getFont()
Retrieves the font used to print thisString
Retrieves theString
int
getX()
Retrieves thex
coordinate of the stringint
getY()
Retrieves they
coordinate of the stringint
hashCode()
void
move
(int x, int y) Moves this element to the given coordinatesvoid
setAngle
(double angle) Set's the angle of the Stringvoid
Set's the font used to render thisString
void
Set's theString
to print in the screenvoid
traslate
(int x, int y) Traslates this element on X and Y
-
Constructor Details
-
GString
Copy constructor- Parameters:
e
-GString
to copy- Throws:
IllegalArgumentException
- ife
isnull
-
GString
GString constructor- Parameters:
x
- X coordinate of the lower left corner of theString
y
- Y coordinate of the lower left corner of theString
str
- String to show
-
GString
GString constructor- Parameters:
x
- X coordinate of the lower left corner of theString
y
- Y coordinate of the lower left corner of theString
str
- String to showfont
-Font
-
GString
GString constructor- Parameters:
x
- X coordinate of the lower left corner of theString
y
- Y coordinate of the lower left corner of theString
a
- The angle in degrees of theString
str
- String to show
-
GString
Complete GString constructor- Parameters:
x
- X coordinate of the lower left corner of theString
y
- Y coordinate of the lower left corner of theString
a
- The angle in degrees of theString
str
- String to showfont
-Font
-
-
Method Details
-
setString
Set's theString
to print in the screen- Parameters:
string
-String
to be printed- Throws:
IllegalArgumentException
- ifstring
isnull
-
getString
Retrieves theString
- Returns:
- string
-
setFont
Set's the font used to render thisString
- Parameters:
font
- font- Throws:
IllegalArgumentException
- iffont
isnull
-
getFont
Retrieves the font used to print thisString
- Returns:
- font
-
setAngle
public void setAngle(double angle) Set's the angle of the String- Parameters:
angle
- angle in degrees
-
getAngle
public double getAngle()Retrieves the angle in degrees of theString
- Returns:
- angle
-
draw
Description copied from class:GraphicE
Draws the component on the given graphics -
getFontMetrics
- Parameters:
g
- TheGraphics2D
that will be used to render thisGString
- Returns:
FontMetrics
object.
-
traslate
public void traslate(int x, int y) Description copied from class:GraphicE
Traslates this element on X and Y -
move
public void move(int x, int y) Moves this element to the given coordinates- Parameters:
x
- new x coordinatey
- new y coordinate
-
clone
-
hashCode
public int hashCode() -
equals
-
getX
public int getX()Retrieves thex
coordinate of the string- Returns:
- x coordinate
-
getY
public int getY()Retrieves they
coordinate of the string- Returns:
- y coordinate
-