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:
$Revision: 1.4 $, $Date: 1996/09/05 23:26:06 $
Author:
Leigh Brookshaw

Variable Index

 o angle
Rotation Angle of text in degrees

Constructor Index

 o RTextLine()
Instantiate the class
 o RTextLine(Component)
Instantiate the class.
 o RTextLine(Font, Color, int)
Instantiate the class
 o RTextLine(Font, Color, int, int)
Instantiate the class
 o RTextLine(String)
Instantiate the class.
 o RTextLine(String, Color)
Instantiate the class
 o RTextLine(String, Font)
Instantiate the class
 o RTextLine(String, Font, Color, int)
Instantiate the class

Method Index

 o copyState(RTextLine)
Copy the state of the parsed Textline into the existing object.
 o draw(Component, Graphics, int, int)
Parse the text, rotate it then draw it to the screen.
 o draw(Graphics, int, int)
Parse the text then draw it.
 o draw(Graphics, int, int, int)
Parse the text then draw it.
 o getBottomEdge(Graphics)
Return the bottom edge of the rotated text.
 o getBottomEdge(Graphics, int)
Return the bottom edge of the rotated text.
 o getComponent()
 o getLeftEdge(Graphics)
Return the left edge of the rotated text.
 o getLeftEdge(Graphics, int)
Return the left edge of the rotated text.
 o getRHeight(Graphics)
The height of the text after it has been rotated.
 o getRightEdge(Graphics)
Return the right edge of the rotated text.
 o getRightEdge(Graphics, int)
Return the right edge of the rotated text.
 o getRotation()
 o getRWidth(Graphics)
The width of the text after it has been rotated.
 o getTopEdge(Graphics)
Return the top edge of the rotated text.
 o getTopEdge(Graphics, int)
Return the top edge of the rotated text.
 o setDrawingComponent(Component)
Set the Component the text will be drawn into.
 o setRotation(int)
Set the text rotation angle.
 o setRotation(int, Component)
Set the Rotation and the Component that will be drawn into

Variables

 o angle
  protected int angle
Rotation Angle of text in degrees

Constructors

 o RTextLine
  public RTextLine()
Instantiate the class
 o RTextLine
  public RTextLine(String s)
Instantiate the class.
Parameters:
s - String to parse.
 o RTextLine
  public RTextLine(Component c)
Instantiate the class.
Parameters:
c - the Component the text will be drawn into.
 o RTextLine
  public RTextLine(String s,
                   Font f)
Instantiate the class
Parameters:
s - String to parse.
f - Font to use.
 o 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
 o RTextLine
  public RTextLine(String s,
                   Color c)
Instantiate the class
Parameters:
s - String to parse.
c - Color to use
 o 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
 o RTextLine
  public RTextLine(Font f,
                   Color c,
                   int j)
Instantiate the class
Parameters:
f - Font to use.
c - Color to use
j - Justification

Methods

 o 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.
 o 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
 o 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
 o 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
 o getRotation
  public int getRotation()
Returns:
the Rotation angle in degrees.
 o getComponent
  public Component getComponent()
Returns:
the Component that will receive the text.
 o 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.
 o 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.
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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
 o 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