Class graph.TextLine
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class graph.TextLine
java.lang.Object
   |
   +----graph.TextLine
  -  public class TextLine
  -  extends Object
This class is designed to bundle together all the information required
to draw short Strings with subscripts and superscripts
  -  Version:
  
-  1.10, 1996/09/05 04:53:27
  
-  Author:
  
-  Leigh Brookshaw
   
  -   ALGEBRAIC ALGEBRAIC
-  Format to use when parsing a double
  
-   ascent ascent
-  The ascent using the current font
  
-   background background
-  Background Color
  
-   CENTER CENTER
-  Center the Text over the point
  
-   color color
-  Text color
  
-   descent descent
-  The descent using the current font
  
-   font font
-  Font to use for text
  
-   fontname fontname
-  The logical name of the font to use
  
-   fontsize fontsize
-  The font size
  
-   fontstyle fontstyle
-  The font style
  
-   height height
-  The height using the current font ie ascent+descent+leading
  
-   justification justification
-  Text justification.
  
-   leading leading
-  The leading using the current font
  
-   LEFT LEFT
-  Position the Text to the Left of the  point
  
-   lg lg
-  Local graphics context.
  
-   list list
-  The parsed string.
  
-   maxAscent maxAscent
-  The maximum ascent using the current font
  
-   maxDescent maxDescent
-  The maximum descent using the current font
  
-   parse parse
-  Has the string been parsed! This only needs to be done once
unless the font is altered.
  
-   RIGHT RIGHT
-  Position the Text to the Right of the  point
  
-   SCIENTIFIC SCIENTIFIC
-  Format to use when parsing a double
  
-   script_fraction script_fraction
-  Decrease in size of successive script levels
  
-   sub_offset sub_offset
-  Subscript offset
  
-   sup_offset sup_offset
-  Superscript offset
  
-   text text
-  The text to display
  
-   width width
-  The width of the text using the current Font
   
  -   TextLine() TextLine()
-  Instantiate the class
  
-   TextLine(Font, Color, int) TextLine(Font, Color, int)
-  Instantiate the class
  
-   TextLine(String) TextLine(String)
-  Instantiate the class.
  
-   TextLine(String, Color) TextLine(String, Color)
-  Instantiate the class
  
-   TextLine(String, Font) TextLine(String, Font)
-  Instantiate the class
  
-   TextLine(String, Font, Color, int) TextLine(String, Font, Color, int)
-  Instantiate the class
   
  -   charWidth(Graphics, char) charWidth(Graphics, char)
-  
  
-   copyState() copyState()
-  Create a New Textline object copying the state of the existing
object into the new one.
  
-   copyState(TextLine) copyState(TextLine)
-  Copy the state of the parsed Textline into the existing
object.
  
-   draw(Graphics, int, int) draw(Graphics, int, int)
-  Parse the text then draw it without any rotation.
  
-   draw(Graphics, int, int, int) draw(Graphics, int, int, int)
-  Parse the text then draw it.
  
-   getAscent(Graphics) getAscent(Graphics)
-  
  
-   getBackground() getBackground()
-  
  
-   getColor() getColor()
-  
  
-   getDescent(Graphics) getDescent(Graphics)
-  
  
-   getFM(Graphics) getFM(Graphics)
-  
  
-   getFont() getFont()
-  
  
-   getFontName() getFontName()
-  
  
-   getFontSize() getFontSize()
-  
  
-   getFontStyle() getFontStyle()
-  
  
-   getHeight(Graphics) getHeight(Graphics)
-  
  
-   getJustification() getJustification()
-  
  
-   getLeading(Graphics) getLeading(Graphics)
-  
  
-   getMaxAscent(Graphics) getMaxAscent(Graphics)
-  
  
-   getMaxDescent(Graphics) getMaxDescent(Graphics)
-  
  
-   getScriptFont(Font) getScriptFont(Font)
-  
  
-   getText() getText()
-  
  
-   getWidth(Graphics) getWidth(Graphics)
-  
  
-   isNull() isNull()
-  
  
-   parseDouble(double) parseDouble(double)
-  Parse a double value.
  
-   parseDouble(double, int) parseDouble(double, int)
-  Parse a double value.
  
-   parseDouble(double, int, int, int) parseDouble(double, int, int, int)
-  Parse a double value
  
-   parseText(Graphics) parseText(Graphics)
-  parse the text.
  
-   setBackground(Color) setBackground(Color)
-  Set the Background Color to use with the class
  
-   setColor(Color) setColor(Color)
-  Set the Color to use with the class
  
-   setFont(Font) setFont(Font)
-  Set the Font to use with the class
  
-   setFontName(String) setFontName(String)
-  Set the Logical font name of the current font
  
-   setFontSize(int) setFontSize(int)
-  Set the Font size of the current font
  
-   setFontStyle(int) setFontStyle(int)
-  Set the Font style of the current font
  
-   setJustification(int) setJustification(int)
-  Set the Justification to use with the class
  
-   setText(String) setText(String)
-  Set the String to use with the class
   
 CENTER
CENTER
  public final static int CENTER
  -  Center the Text over the point
 LEFT
LEFT
  public final static int LEFT
  -  Position the Text to the Left of the  point
 RIGHT
RIGHT
  public final static int RIGHT
  -  Position the Text to the Right of the  point
 SCIENTIFIC
SCIENTIFIC
  public final static int SCIENTIFIC
  -  Format to use when parsing a double
 ALGEBRAIC
ALGEBRAIC
  public final static int ALGEBRAIC
  -  Format to use when parsing a double
 script_fraction
script_fraction
  protected double script_fraction
  -  Decrease in size of successive script levels
 sup_offset
sup_offset
  protected double sup_offset
  -  Superscript offset
 sub_offset
sub_offset
  protected double sub_offset
  -  Subscript offset
 font
font
  protected Font font
  -  Font to use for text
 color
color
  protected Color color
  -  Text color
 background
background
  protected Color background
  -  Background Color
 text
text
  protected String text
  -  The text to display
 fontname
fontname
  protected String fontname
  -  The logical name of the font to use
 fontsize
fontsize
  protected int fontsize
  -  The font size
 fontstyle
fontstyle
  protected int fontstyle
  -  The font style
 justification
justification
  protected int justification
  -  Text justification. Either CENTER, LEFT or RIGHT
 width
width
  protected int width
  -  The width of the text using the current Font
 ascent
ascent
  protected int ascent
  -  The ascent using the current font
 maxAscent
maxAscent
  protected int maxAscent
  -  The maximum ascent using the current font
 descent
descent
  protected int descent
  -  The descent using the current font
 maxDescent
maxDescent
  protected int maxDescent
  -  The maximum descent using the current font
 height
height
  protected int height
  -  The height using the current font ie ascent+descent+leading
 leading
leading
  protected int leading
  -  The leading using the current font
 parse
parse
  protected boolean parse
  -  Has the string been parsed! This only needs to be done once
unless the font is altered.
 lg
lg
  protected Graphics lg
  -  Local graphics context.
 list
list
  protected Vector list
  -  The parsed string. Each element in the vector represents
a change of context in the string ie font change and offset.
   
 TextLine
TextLine
  public TextLine()
  -  Instantiate the class
 TextLine
TextLine
  public TextLine(String s)
  -  Instantiate the class.
  
    -  Parameters:
    
-  s - String to parse.
  
 
 TextLine
TextLine
  public TextLine(String s,
                  Font f)
  -  Instantiate the class
  
    -  Parameters:
    
-  s - String to parse.
    -  f - Font to use.
  
 
 TextLine
TextLine
  public TextLine(String s,
                  Font f,
                  Color c,
                  int j)
  -  Instantiate the class
  
    -  Parameters:
    
-  s - String to parse.
    -  f - Font to use.
    -  c - Color to use
    -  j - Justification
  
 
 TextLine
TextLine
  public TextLine(String s,
                  Color c)
  -  Instantiate the class
  
    -  Parameters:
    
-  s - String to parse.
    -  c - Color to use
  
 
 TextLine
TextLine
  public TextLine(Font f,
                  Color c,
                  int j)
  -  Instantiate the class
  
    -  Parameters:
    
-  f - Font to use.
    -  c - Color to use
    -  j - Justification
  
 
   
 copyState
copyState
  public TextLine copyState()
  -  Create a New Textline object copying the state of the existing
object into the new one. The state of the class is the color,
font, and justification ie everything but the string.
 copyState
copyState
  public void copyState(TextLine t)
  -  Copy the state of the parsed Textline into the existing
object.
  
    -  Parameters:
    
-  t - The TextLine to get the state information from.
  
 
 setFont
setFont
  public void setFont(Font f)
  -  Set the Font to use with the class
  
    -  Parameters:
    
-  f - Font
  
 
 setText
setText
  public void setText(String s)
  -  Set the String to use with the class
  
    -  Parameters:
    
-  s - String
  
 
 setColor
setColor
  public void setColor(Color c)
  -  Set the Color to use with the class
  
    -  Parameters:
    
-  c - Color
  
 
 setBackground
setBackground
  public void setBackground(Color c)
  -  Set the Background Color to use with the class
  
    -  Parameters:
    
-  c - Color
  
 
 setJustification
setJustification
  public void setJustification(int i)
  -  Set the Justification to use with the class
  
    -  Parameters:
    
-  t - Justification
  
 
 getFont
getFont
  public Font getFont()
  
    -  Returns:
    
-  the font the class is using
  
 getText
getText
  public String getText()
  
    -  Returns:
    
-  the String the class is using.
  
 getColor
getColor
  public Color getColor()
  
    -  Returns:
    
-  the Color the class is using.
  
 getBackground
getBackground
  public Color getBackground()
  
    -  Returns:
    
-  the Background Color the class is using.
  
 getJustification
getJustification
  public int getJustification()
  
    -  Returns:
    
-  the Justification the class is using.
  
 getFM
getFM
  public FontMetrics getFM(Graphics g)
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the Fontmetrics the class is using.
  
 charWidth
charWidth
  public int charWidth(Graphics g,
                       char ch)
  
    -  Parameters:
    
-  g - Graphics context.
    -  ch - The character.
    
-  Returns:
    
-  the width of the character.
  
 getWidth
getWidth
  public int getWidth(Graphics g)
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the width of the parsed text.
  
 getHeight
getHeight
  public int getHeight(Graphics g)
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the height of the parsed text.
  
 getAscent
getAscent
  public int getAscent(Graphics g)
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the ascent of the parsed text.
  
 getMaxAscent
getMaxAscent
  public int getMaxAscent(Graphics g)
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the maximum ascent of the parsed text.
  
 getDescent
getDescent
  public int getDescent(Graphics g)
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the descent of the parsed text.
  
 getMaxDescent
getMaxDescent
  public int getMaxDescent(Graphics g)
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the maximum descent of the parsed text.
  
 getLeading
getLeading
  public int getLeading(Graphics g)
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the leading of the parsed text.
  
 parseText
parseText
  public void parseText(Graphics g)
  -  parse the text. When the text is parsed the width, height, leading
are all calculated. The text will only be truly parsed if
the graphics context has changed or the text has changed or
the font has changed. Otherwise nothing is done when this
method is called.
  
    -  Parameters:
    
-  g - Graphics context.
  
 
 isNull
isNull
  public boolean isNull()
  
    -  Returns:
    
-  true if the text has never been set or is null
  
 draw
draw
  public void draw(Graphics g,
                   int x,
                   int y,
                   int j)
  -  Parse the text then draw it.
  
    -  Parameters:
    
-  g - Graphics context
    -  x - pixel position of the text
    -  y - pixel position of the text
    -  j - justification of the text
  
 
 draw
draw
  public void draw(Graphics g,
                   int x,
                   int y)
  -  Parse the text then draw it without any rotation.
  
    -  Parameters:
    
-  g - Graphics context
    -  x - pixel position of the text
    -  y - pixel position of the text
  
 
 getFontName
getFontName
  public String getFontName()
  
    -  Returns:
    
-  Logical font name of the set font
  
 getFontStyle
getFontStyle
  public int getFontStyle()
  
    -  Returns:
    
-  Style of the set font
  
 getFontSize
getFontSize
  public int getFontSize()
  
    -  Returns:
    
-  Size of the set font
  
 setFontName
setFontName
  public void setFontName(String s)
  -  Set the Logical font name of the current font
  
    -  Parameters:
    
-  s - Logical font name.
  
 
 setFontStyle
setFontStyle
  public void setFontStyle(int i)
  -  Set the Font style of the current font
  
    -  Parameters:
    
-  i - Font style.
  
 
 setFontSize
setFontSize
  public void setFontSize(int i)
  -  Set the Font size of the current font
  
    -  Parameters:
    
-  i - Font size.
  
 
 getScriptFont
getScriptFont
  public Font getScriptFont(Font f)
  
    -  Parameters:
    
-  f - Font
    
-  Returns:
    
-  The script font version of the parsed font using the
       script_fraction variable.
  
 parseDouble
parseDouble
  public boolean parseDouble(double d)
  -  Parse a double value. Precision is 6 figures, with 7 significant
figures.
  
    -  Parameters:
    
-  d - double to parse
return true if the parse was successful
  
 
 parseDouble
parseDouble
  public boolean parseDouble(double d,
                             int p)
  -  Parse a double value. Number of significant figures is 1 greater than
the precision.
  
    -  Parameters:
    
-  d - double to parse
    -  p - precision of the number
return true if the parse was successful
  
 
 parseDouble
parseDouble
  public boolean parseDouble(double d,
                             int n,
                             int p,
                             int f)
  -  Parse a double value
  
    -  Parameters:
    
-  d - double to parse
    -  n - number of significant figures
    -  p - precision of the number
    -  f - format of the number scientific, algebraic etc.
return true if the parse was successful
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index