All Packages Class Hierarchy This Package Previous Next Index
Class att.grappa.TextLabelPeer
java.lang.Object
|
+----att.grappa.TextLabelPeer
- public class TextLabelPeer
- extends Object
A class for drawing text labels.
The TextLabelPeer
is associated with a
DrawObjectPeer
and a TextLabel
.
- Version:
- 1.1, 30 Sep 1999; Copyright 1996 - 1999 by AT&T Corp.
- Author:
- John Mocenigo, Research @ AT&T Labs
-
TextLabelPeer(DrawObjectPeer, TextLabel)
- Creates a
TextLabelPeer
instance.
-
draw(Graphics, GraphicContext)
- Draws the text label using the specified graphics information.
-
drawString(String, Point, int, GraphicContext, Graphics, DrawPane)
- Draw a string in the drawing pane.
-
getBounds()
- Gets the bounds of this peer in terms of the
DrawPane
coordinates.
-
getCenter()
- Get the (scaled) center point of the text.
-
getDrawObject()
- Get the
DrawObject
associated with this object.
-
getDrawObjectPeer()
- Get the
DrawObjectPeer
associated with this object.
-
getDrawPane()
- Get the
DrawPane
associated with this object.
-
getTextLabel()
- Get the
TextLabel
associated with this object.
-
inPeer(int, int)
- Checks if the supplied co-ordinates are in
this peer.
-
setupPeer()
- Setup this peer.
TextLabelPeer
public TextLabelPeer(DrawObjectPeer drwObjPr,
TextLabel textLabel)
- Creates a
TextLabelPeer
instance.
- Parameters:
- drwObjPr - the
DrawObjectPeer
associated with this TextLabelPeer
- textLabel - the
TextLabel
associated with this peer
getBounds
public Rectangle getBounds()
- Gets the bounds of this peer in terms of the
DrawPane
coordinates.
- Returns:
- the bounding box of the peer
inPeer
public boolean inPeer(int x,
int y)
- Checks if the supplied co-ordinates are in
this peer.
- Parameters:
- x - the x co-ordinate to check
- y - the y co-ordinate to check
- Returns:
- true if the co-ordinates lie inside the peer; false otherwise.
draw
public void draw(Graphics gr,
GraphicContext context)
- Draws the text label using the specified graphics information.
- Parameters:
- gr - the AWT graphics context to use for drawing, if the value
is null, then the off-screen canvas
Graphics
is used.
- context - the graphic context to use when drawing.
If the context is null, the object's context is used.
getDrawObjectPeer
public DrawObjectPeer getDrawObjectPeer()
- Get the
DrawObjectPeer
associated with this object.
- Returns:
- the associated
DrawObjectPeer
.
getDrawObject
public DrawObject getDrawObject()
- Get the
DrawObject
associated with this object.
The association is through the DrawObjectPeer
.
- Returns:
- the associated
DrawObject
.
- See Also:
- getDrawObjectPeer
getTextLabel
public TextLabel getTextLabel()
- Get the
TextLabel
associated with this object.
- Returns:
- the associated
TextLabel
.
getDrawPane
public DrawPane getDrawPane()
- Get the
DrawPane
associated with this object.
The association is through the DrawObjectPeer
.
- Returns:
- the associated
DrawPane
.
- See Also:
- getDrawObjectPeer
setupPeer
public void setupPeer()
- Setup this peer.
The setup does the actual co-ordinate mappings from what is available
in the
TextLabel
object to the DrawPane
co-ordinates.
drawString
public static void drawString(String text,
Point pt,
int justify,
GraphicContext gc,
Graphics gr,
DrawPane dp)
- Draw a string in the drawing pane.
- Parameters:
- text - the text to draw
- pt - the center point of the text in graph co-ordinates
- justify - text justification indicator
- gc - the Grappa graphic context to use
- gr - the AWT graphic context to use
- dp - the drawing pane whose linear mapping will be used
getCenter
public Point getCenter()
- Get the (scaled) center point of the text.
- Returns:
- the text center point.
All Packages Class Hierarchy This Package Previous Next Index