All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class att.grappa.TextLabel

java.lang.Object
   |
   +----att.grappa.TextLabel

public class TextLabel
extends Object
Essentially a structure for storing labelling info.

Version:
1.1, 30 Sep 1999; Copyright 1996 - 1999 by AT&T Corp.
Author:
John Mocenigo, Research @ AT&T Labs

Variable Index

 o constantFontwidth
Rough font sizing information for the courier (or constant) font.
 o helveticaFontwidth
Rough font sizing information for the helvetica (or sansserif) font.
 o JUSTIFY_BOTTOM
Indicates that text should be bottom justified.
 o JUSTIFY_CENTER
Indicates that text should be center justified.
 o JUSTIFY_LEFT
Indicates that text should be left justified.
 o JUSTIFY_MIDDLE
Indicates that text should be middle justified.
 o JUSTIFY_RIGHT
Indicates that text should be right justified.
 o JUSTIFY_TOP
Indicates that text should be top justified.
 o NBSP
The Unicode no-break space character.
 o romanFontwidth
Rough font sizing information for the roman (or serif) font.

Constructor Index

 o TextLabel(DrawObject, String, GraphicContext, Point)
Create a new TextLabel instance associated with a DrawObject.

Method Index

 o equals(Object)
Determines whether two text labels are equal.
 o getBounds()
Get the bounding box of this text label.
 o getDrawObject()
Get the draw object associated with this object.
 o getGraphicContext()
Get the graphic context supplied when this object was created.
 o getPosition()
Get the position of the text label.
 o getSetupGC()
Get the graphic context used for setting up this object.
 o getSize()
Get the size of the text label.
 o getText()
Get the label text.
 o hasText()
Check if this object has text associated with it.
 o lineCount()
Return a count of the lines of text.
 o lines()
Return an enumeration of the lines of text.
 o resetSetupFlag()
Set the value of the setup indicator to false.
 o sameText(String)
Checks if the supplied text is the same as the text in this label.
 o sameText(TextLabel)
Checks if the supplied TextLabel contains the same text and this one.
 o setSetupFlag()
Set the value of the setup indicator to true.
 o setText(String)
Change the text of the label.
 o setupNeeded()
Check if it appears that this object needs to be set-up

Variables

 o NBSP
 public static final char NBSP
The Unicode no-break space character.

 o JUSTIFY_LEFT
 public static final int JUSTIFY_LEFT
Indicates that text should be left justified.

 o JUSTIFY_CENTER
 public static final int JUSTIFY_CENTER
Indicates that text should be center justified.

 o JUSTIFY_RIGHT
 public static final int JUSTIFY_RIGHT
Indicates that text should be right justified.

 o JUSTIFY_TOP
 public static final int JUSTIFY_TOP
Indicates that text should be top justified.

 o JUSTIFY_MIDDLE
 public static final int JUSTIFY_MIDDLE
Indicates that text should be middle justified.

 o JUSTIFY_BOTTOM
 public static final int JUSTIFY_BOTTOM
Indicates that text should be bottom justified.

 o romanFontwidth
 public static final double romanFontwidth[]
Rough font sizing information for the roman (or serif) font.

 o helveticaFontwidth
 public static final double helveticaFontwidth[]
Rough font sizing information for the helvetica (or sansserif) font.

 o constantFontwidth
 public static final double constantFontwidth
Rough font sizing information for the courier (or constant) font.

Constructors

 o TextLabel
 public TextLabel(DrawObject drwObj,
                  String str,
                  GraphicContext context,
                  Point pos)
Create a new TextLabel instance associated with a DrawObject.

Parameters:
drwObj - the DrawObject associated with this TextLabel
str - the text of the label
context - the graohic context to use with the label
pos - the label position (in graph co-ordinates)

Methods

 o getSize
 public Dimension getSize()
Get the size of the text label.

Returns:
the size
 o getPosition
 public Point getPosition()
Get the position of the text label.

Returns:
the position
 o setText
 public void setText(String str)
Change the text of the label.

Parameters:
str - the new label text
 o getText
 public String getText()
Get the label text.

Returns:
the label text.
 o hasText
 public boolean hasText()
Check if this object has text associated with it.

Returns:
true is there is associated text of length greater than zero; false otherwise.
 o getGraphicContext
 public GraphicContext getGraphicContext()
Get the graphic context supplied when this object was created.

Returns:
the creation graphic context.
 o getSetupGC
 public GraphicContext getSetupGC()
Get the graphic context used for setting up this object.

Returns:
the setup graphic context.
 o lines
 public Enumeration lines()
Return an enumeration of the lines of text.

Returns:
an enumeration of TextLine objects.
 o lineCount
 public int lineCount()
Return a count of the lines of text.

Returns:
a count of lines of text in the label.
 o getBounds
 public Rectangle getBounds()
Get the bounding box of this text label.

Returns:
the bounding box.
 o sameText
 public boolean sameText(TextLabel tl)
Checks if the supplied TextLabel contains the same text and this one.

Returns:
true if text labels in each TextLabel are equal; false otherwise.
 o sameText
 public boolean sameText(String txt)
Checks if the supplied text is the same as the text in this label.

Returns:
true if text equals the text in this label; false otherwise.
 o equals
 public boolean equals(Object obj)
Determines whether two text labels are equal. Two instances of TextLabel are equal if their text, position and graphic context are equal.

Parameters:
obj - an object to be compared with this point.
Returns:
true if the object to be compared is an instance of TextLabel and has the same values; false otherwise.
Overrides:
equals in class Object
See Also:
sameText, getPosition, getGraphicContext
 o getDrawObject
 public DrawObject getDrawObject()
Get the draw object associated with this object.

Returns:
the associated DrawObject.
 o setupNeeded
 public boolean setupNeeded()
Check if it appears that this object needs to be set-up

Returns:
true if setup is required, false otherwise
 o setSetupFlag
 public void setSetupFlag()
Set the value of the setup indicator to true.

See Also:
setupNeeded
 o resetSetupFlag
 public void resetSetupFlag()
Set the value of the setup indicator to false.

See Also:
setupNeeded

All Packages  Class Hierarchy  This Package  Previous  Next  Index