Class graph.RTextLine
All Packages  Class Hierarchy  This Package  Previous  Next  Index
  Class graph.RTextLine
java.lang.Object
   |
   +----graph.TextLine
           |
           +----graph.RTextLine
  -  public class RTextLine
  -  extends TextLine
This class is an extension of the TextLine Class
that allows text to be rotated. To rotate the text the Component.createImage
method is used. This means that this class needs to know
the component that will receive the text. If the component is not
known the text cannot be rotated and the class will fall back to the
TextLine.draw method.
The text is rotated by running the image through an ImageFilter. This filter
can easily be modified to rotate text through an arbitrary angle but
unless the text is large the integer mapping will blur the text. 
Also positioning of arbitrarily rotated text becomes problematic.
  -  Version:
  
-  1.5, 1996/10/23 03:13:45
  
-  Author:
  
-  Leigh Brookshaw
   
  -   angle angle
-  Rotation Angle of text in degrees
   
  -   RTextLine() RTextLine()
-  Instantiate the class
  
-   RTextLine(Component) RTextLine(Component)
-  Instantiate the class.
  
-   RTextLine(Font, Color, int) RTextLine(Font, Color, int)
-  Instantiate the class
  
-   RTextLine(Font, Color, int, int) RTextLine(Font, Color, int, int)
-  Instantiate the class
  
-   RTextLine(String) RTextLine(String)
-  Instantiate the class.
  
-   RTextLine(String, Color) RTextLine(String, Color)
-  Instantiate the class
  
-   RTextLine(String, Font) RTextLine(String, Font)
-  Instantiate the class
  
-   RTextLine(String, Font, Color, int) RTextLine(String, Font, Color, int)
-  Instantiate the class
   
  -   copyState(RTextLine) copyState(RTextLine)
-  Copy the state of the parsed Textline into the existing
object.
  
-   draw(Component, Graphics, int, int) draw(Component, Graphics, int, int)
-  Parse the text, rotate it then draw it to the screen.
  
-   draw(Graphics, int, int) draw(Graphics, int, int)
-  Parse the text then draw it.
  
-   draw(Graphics, int, int, int) draw(Graphics, int, int, int)
-  Parse the text then draw it.
  
-   getBottomEdge(Graphics) getBottomEdge(Graphics)
-  Return the bottom edge of the rotated text.
  
-   getBottomEdge(Graphics, int) getBottomEdge(Graphics, int)
-  Return the bottom edge of the rotated text.
  
-   getComponent() getComponent()
-  
  
-   getLeftEdge(Graphics) getLeftEdge(Graphics)
-  Return the left edge of the rotated text.
  
-   getLeftEdge(Graphics, int) getLeftEdge(Graphics, int)
-  Return the left edge of the rotated text.
  
-   getRHeight(Graphics) getRHeight(Graphics)
-  The height of the text after it has been rotated.
  
-   getRightEdge(Graphics) getRightEdge(Graphics)
-  Return the right edge of the rotated text.
  
-   getRightEdge(Graphics, int) getRightEdge(Graphics, int)
-  Return the right edge of the rotated text.
  
-   getRotation() getRotation()
-  
  
-   getRWidth(Graphics) getRWidth(Graphics)
-  The width of the text after it has been rotated.
  
-   getTopEdge(Graphics) getTopEdge(Graphics)
-  Return the top edge of the rotated text.
  
-   getTopEdge(Graphics, int) getTopEdge(Graphics, int)
-  Return the top edge of the rotated text.
  
-   setDrawingComponent(Component) setDrawingComponent(Component)
-  Set the Component the text will be drawn into.
  
-   setRotation(int) setRotation(int)
-  Set the text rotation angle.
  
-   setRotation(int, Component) setRotation(int, Component)
-  Set the Rotation and the Component that will be drawn into
   
 angle
angle
  protected int angle
  -  Rotation Angle of text in degrees
   
 RTextLine
RTextLine
  public RTextLine()
  -  Instantiate the class
 RTextLine
RTextLine
  public RTextLine(String s)
  -  Instantiate the class.
  
    -  Parameters:
    
-  s - String to parse.
  
 
 RTextLine
RTextLine
  public RTextLine(Component c)
  -  Instantiate the class.
  
    -  Parameters:
    
-  c - the Component the text will be drawn into.
  
 
 RTextLine
RTextLine
  public RTextLine(String s,
                   Font f)
  -  Instantiate the class
  
    -  Parameters:
    
-  s - String to parse.
    -  f - Font to use.
  
 
 RTextLine
RTextLine
  public RTextLine(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
  
 
 RTextLine
RTextLine
  public RTextLine(String s,
                   Color c)
  -  Instantiate the class
  
    -  Parameters:
    
-  s - String to parse.
    -  c - Color to use
  
 
 RTextLine
RTextLine
  public RTextLine(Font f,
                   Color c,
                   int j,
                   int a)
  -  Instantiate the class
  
    -  Parameters:
    
-  f - Font to use.
    -  c - Color to use
    -  j - Justification
    -  a - Rotation angle in degrees
  
 
 RTextLine
RTextLine
  public RTextLine(Font f,
                   Color c,
                   int j)
  -  Instantiate the class
  
    -  Parameters:
    
-  f - Font to use.
    -  c - Color to use
    -  j - Justification
  
 
   
 copyState
copyState
  public void copyState(RTextLine t)
  -  Copy the state of the parsed Textline into the existing
object.
  
    -  Parameters:
    
-  t - The TextLine to get the state information from.
  
 
 setRotation
setRotation
  public void setRotation(int angle)
  -  Set the text rotation angle. Only multiples of 90 degrees
are accepted
  
    -  Parameters:
    
-  angle - The angle to rotate the text
  
 
 setDrawingComponent
setDrawingComponent
  public void setDrawingComponent(Component c)
  -  Set the Component the text will be drawn into. This is required to rotate
the text. if it is not set the text will not be rotated.
  
    -  Parameters:
    
-  c - The drawing component
  
 
 setRotation
setRotation
  public void setRotation(int angle,
                          Component c)
  -  Set the Rotation and the Component that will be drawn into
  
    -  Parameters:
    
-  angle - The angle to rotate the text
    -  c - The drawing component
  
 
 getRotation
getRotation
  public int getRotation()
  
    -  Returns:
    
-  the Rotation angle in degrees.
  
 getComponent
getComponent
  public Component getComponent()
  
    -  Returns:
    
-  the Component that will receive the text.
  
 getRWidth
getRWidth
  public int getRWidth(Graphics g)
  -  The width of the text after it has been rotated.
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the width of the parsed text after it has been rotated.
  
 
 getRHeight
getRHeight
  public int getRHeight(Graphics g)
  -  The height of the text after it has been rotated.
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the height of the parsed text after it has been rotated.
  
 
 getLeftEdge
getLeftEdge
  public int getLeftEdge(Graphics g)
  -  Return the left edge of the rotated text. 
This is dependent on the justification of the text.
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the Left edge of the rotated text
  
 
 getRightEdge
getRightEdge
  public int getRightEdge(Graphics g)
  -  Return the right edge of the rotated text. 
This is dependent on the justification of the text.
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the Right edge of the rotated text
  
 
 getTopEdge
getTopEdge
  public int getTopEdge(Graphics g)
  -  Return the top edge of the rotated text. 
This is dependent on the justification of the text.
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the Top edge of the rotated text
  
 
 getBottomEdge
getBottomEdge
  public int getBottomEdge(Graphics g)
  -  Return the bottom edge of the rotated text. 
This is dependent on the justification of the text.
  
    -  Parameters:
    
-  g - Graphics context.
    
-  Returns:
    
-  the Bottom edge of the rotated text
  
 
 getLeftEdge
getLeftEdge
  public int getLeftEdge(Graphics g,
                         int j)
  -  Return the left edge of the rotated text.
  
    -  Parameters:
    
-  g - Graphics context.
    -  j - Text justification
    
-  Returns:
    
-  the Left edge of the rotated text
  
 
 getRightEdge
getRightEdge
  public int getRightEdge(Graphics g,
                          int j)
  -  Return the right edge of the rotated text.
  
    -  Parameters:
    
-  g - Graphics context.
    -  j - Text justification
    
-  Returns:
    
-  the Right edge of the rotated text
  
 
 getTopEdge
getTopEdge
  public int getTopEdge(Graphics g,
                        int j)
  -  Return the top edge of the rotated text.
  
    -  Parameters:
    
-  g - Graphics context.
    -  j - Text justification
    
-  Returns:
    
-  the Top edge of the rotated text
  
 
 getBottomEdge
getBottomEdge
  public int getBottomEdge(Graphics g,
                           int j)
  -  Return the bottom edge of the rotated text.
  
    -  Parameters:
    
-  g - Graphics context.
    -  j - Text justification
    
-  Returns:
    
-  the Bottom edge of the rotated text
  
 
 draw
draw
  public void draw(Graphics g,
                   int x,
                   int y)
  -  Parse the text then draw it.
  
    -  Parameters:
    
-  g - Graphics context
    -  x - pixel position of the text
    -  y - pixel position of the text
    
-  Overrides:
    
-  draw in class TextLine
  
 
 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
    
-  Overrides:
    
-  draw in class TextLine
  
 
 draw
draw
  public synchronized void draw(Component comp,
                                Graphics g,
                                int x,
                                int y)
  -  Parse the text, rotate it then draw it to the screen.
  
    -  Parameters:
    
-  g - Graphics context
    -  x - pixel position of the text
    -  y - pixel position of the text
  
 
All Packages  Class Hierarchy  This Package  Previous  Next  Index