|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--jimmc.treepar.LayoutGraphics
LayoutGraphics holds a Graphics object and a transformation between the Layout and the window in which it is being drawn.
Field Summary | |
protected java.awt.Graphics |
graphics
Our Graphics object. |
protected java.awt.Rectangle |
layoutBounds
The bounds of the layout we are drawing. |
protected java.awt.Rectangle |
windowBounds
The bounds of the window area we are drawing into. |
protected int |
xScaleDown
Denominator of scaling fraction for x. |
protected int |
xScaleUp
Numerator of scaling fraction for x. |
protected int |
xTranslate
Post-scaling translation for x. |
protected int |
yScaleDown
Denominator of scaling fraction for y. |
protected int |
yScaleUp
Numerator of scaling fraction for y. |
protected int |
yTranslate
Post-scaling translation for y. |
Constructor Summary | |
LayoutGraphics(java.awt.Graphics graphics)
Create a new LayoutGraphics. |
Method Summary | |
protected void |
calculateTransform()
Calculate the transformation we use on points to take them from the Layout coordinate system to the window coordinate system. |
void |
drawBox(java.awt.Point origin,
java.awt.Dimension size)
Draw the outline of a box. |
void |
drawLine(int x0,
int y0,
int x1,
int y1)
Draw a line. |
void |
drawLine(java.awt.Point p0,
java.awt.Point p1)
Draw a line between two points. |
void |
drawString(java.lang.String text,
int x,
int y)
Draw some text. |
void |
drawString(java.lang.String text,
java.awt.Point p)
Draw some text. |
protected int |
reverseTransformX(int x)
Reverse-transform an X value to convert screen coordinates to layout coordinates. |
protected int |
reverseTransformY(int y)
Reverse-transform a Y value to convert screen coordinates to layout coordinates. |
void |
setFont(int lineHeight)
Set a font to render character the right size. |
void |
setLayoutBounds(java.awt.Rectangle r)
Set the bounds of the Layout we are drawing. |
void |
setWindowBounds(java.awt.Rectangle r)
Set the bounds of the window into which we are drawing. |
void |
setWindowSize(java.awt.Dimension d)
Set the size of the window into which we are drawing. |
protected int |
transformX(int x)
Transform an X value through our coordinate transform. |
protected int |
transformY(int y)
Transform an Y value through our coordinate transform. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected java.awt.Graphics graphics
protected java.awt.Rectangle layoutBounds
protected java.awt.Rectangle windowBounds
protected int xScaleUp
protected int xScaleDown
protected int xTranslate
protected int yScaleUp
protected int yScaleDown
protected int yTranslate
Constructor Detail |
public LayoutGraphics(java.awt.Graphics graphics)
Method Detail |
public void setWindowSize(java.awt.Dimension d)
sz
- the size of the window; we use the whole window
for drawing.public void setWindowBounds(java.awt.Rectangle r)
r
- the region of the window into which we should draw.public void setLayoutBounds(java.awt.Rectangle r)
r
- the bounds of the layout.protected void calculateTransform()
public void setFont(int lineHeight)
protected int transformX(int x)
protected int transformY(int y)
protected int reverseTransformX(int x)
protected int reverseTransformY(int y)
public void drawLine(java.awt.Point p0, java.awt.Point p1)
public void drawLine(int x0, int y0, int x1, int y1)
public void drawBox(java.awt.Point origin, java.awt.Dimension size)
public void drawString(java.lang.String text, java.awt.Point p)
public void drawString(java.lang.String text, int x, int y)
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |