Class GString
java.lang.Object
|
+--Subject
|
+--Shape
|
+--GString
- public class GString
- extends Shape
A GString (Graphical String) is a Shape.
GStrings have all methods and attributes of Shape
and then some more.
Constructor Summary |
GString(java.awt.Color c,
java.lang.String text,
int x,
int y)
Initialize a new GString with specified Color, text and position |
Method Summary |
void |
display(java.awt.Graphics g)
produce a graphical representation of this |
java.lang.String |
getText()
|
void |
setText(java.lang.String t)
Set the text of this and tell our observer that we have changed |
java.lang.String |
toString()
|
Methods inherited from class Subject |
attachObserver,
detachObserver,
notifyObserver |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
GString
public GString(java.awt.Color c,
java.lang.String text,
int x,
int y)
- Initialize a new GString with specified Color, text and position
- Parameters:
c
- the desired colortext
- the desired textx
- the desired x coordinatey
- the desired x coordinate
setText
public void setText(java.lang.String t)
- Set the text of this and tell our observer that we have changed
- Parameters:
t
- the desired text- Returns:
- nothing
getText
public java.lang.String getText()
- Returns:
- the text of this
toString
public java.lang.String toString()
- Returns:
- a String representation of this
- Overrides:
- toString in class Shape
display
public void display(java.awt.Graphics g)
- produce a graphical representation of this
- Parameters:
g
- the pen we use to display this- Overrides:
- display in class Shape