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
ConstructorsConstructorDescriptionGString constructorComplete GString constructorGString constructorGString constructorCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionclone()voiddraw(Graphics2D g) Draws the component on the given graphicsbooleandoublegetAngle()Retrieves the angle in degrees of theStringgetFont()Retrieves the font used to print thisStringRetrieves theStringintgetX()Retrieves thexcoordinate of the stringintgetY()Retrieves theycoordinate of the stringinthashCode()voidmove(int x, int y) Moves this element to the given coordinatesvoidsetAngle(double angle) Set's the angle of the StringvoidSet's the font used to render thisStringvoidSet's theStringto print in the screenvoidtraslate(int x, int y) Traslates this element on X and Y
-
Constructor Details
-
GString
Copy constructor- Parameters:
e-GStringto copy- Throws:
IllegalArgumentException- ifeisnull
-
GString
GString constructor- Parameters:
x- X coordinate of the lower left corner of theStringy- Y coordinate of the lower left corner of theStringstr- String to show
-
GString
GString constructor- Parameters:
x- X coordinate of the lower left corner of theStringy- Y coordinate of the lower left corner of theStringstr- String to showfont-Font
-
GString
GString constructor- Parameters:
x- X coordinate of the lower left corner of theStringy- Y coordinate of the lower left corner of theStringa- The angle in degrees of theStringstr- String to show
-
GString
Complete GString constructor- Parameters:
x- X coordinate of the lower left corner of theStringy- Y coordinate of the lower left corner of theStringa- The angle in degrees of theStringstr- String to showfont-Font
-
-
Method Details
-
setString
Set's theStringto print in the screen- Parameters:
string-Stringto be printed- Throws:
IllegalArgumentException- ifstringisnull
-
getString
Retrieves theString- Returns:
- string
-
setFont
Set's the font used to render thisString- Parameters:
font- font- Throws:
IllegalArgumentException- iffontisnull
-
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:GraphicEDraws the component on the given graphics -
getFontMetrics
- Parameters:
g- TheGraphics2Dthat will be used to render thisGString- Returns:
FontMetricsobject.
-
traslate
public void traslate(int x, int y) Description copied from class:GraphicETraslates 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 thexcoordinate of the string- Returns:
- x coordinate
-
getY
public int getY()Retrieves theycoordinate of the string- Returns:
- y coordinate
-