|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--edu.hws.jcm.draw.Drawable | +--edu.hws.jcm.draw.Axes
A set of horizontal and vertical axes that look OK and have reasonable, labeled tick marks. The number and spacing of tick marks changes depending on the scale on the axes. (The heuristics for computing this could use some improvement.)
Field Summary | |
static int |
BOTTOM
A constant that can be used in the setYAxisPosition() method to indicate the placement of the y-axs. |
static int |
CENTER
A constant that can be used in the setXAxisPosition() and setYAxisPosition() methods to indicate the placement of the axes. |
static int |
LEFT
A constant that can be used in the setXAxisPosition() method to indicate the placement of the x-axis. |
static int |
RIGHT
A constant that can be used in the setXAxisPosition() method to indicate the placement of the x-axis. |
static int |
SMART
A constant that can be used in the setXAxisPosition() and setYAxisPosition() methods to indicate the placement of the axes. |
static int |
TOP
A constant that can be used in the setYAxisPosition() method to indicate the placement of the y-axis. |
Fields inherited from class edu.hws.jcm.draw.Drawable |
canvas, coords |
Constructor Summary | |
Axes()
Creates axes with no names on the axes. |
|
Axes(java.lang.String xLabel,
java.lang.String yLabel)
Creates axes with given names on the axes. |
Method Summary | |
void |
draw(java.awt.Graphics g,
boolean coordsChanged)
Draw the axes. |
java.awt.Color |
getAxesColor()
Get the color that is used for drawing the axes, when they are drawn in their true position. |
java.awt.Color |
getLabelColor()
Get the color that is used for drawing the labels on the x- and y-axes. |
java.awt.Color |
getLightAxesColor()
Get the color that is used for drawing an axis, when it is drawn along an edge of the CoordinateRect instead of in its proper x- or y-position. |
int |
getXAxisPosition()
Get the positioning constant that tells where the x-axis is drawn. |
java.lang.String |
getXLabel()
Get the label that appears on the x-axis. |
int |
getYAxisPosition()
Get the positioning constant that tells where the y-axis is drawn. |
java.lang.String |
getYLabel()
Get the label that appears on the y-axis. |
void |
setAxesColor(java.awt.Color c)
Set the color that is used for drawing the axes, when they are drawn in their true position. |
void |
setLabelColor(java.awt.Color c)
Set the color that is used for drawing the labels (usually the names of the variables) on the x- and y-axes. |
void |
setLightAxesColor(java.awt.Color c)
Get the color that is used for drawing an axis, when it is drawn along an edge of the CoordinateRect instead of in its proper x- or y-position. |
void |
setXAxisPosition(int pos)
Set the positioning constant that tells where the x-axis is drawn. |
void |
setXLabel(java.lang.String s)
Set the label that appears on the x-axis. |
void |
setYAxisPosition(int pos)
Set the positioning constant that tells where the y-axis is drawn. |
void |
setYLabel(java.lang.String s)
Set the label that appears on the y-axis. |
Methods inherited from class edu.hws.jcm.draw.Drawable |
getVisible, needsRedraw, setOwnerData, setVisible |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int TOP
public static final int BOTTOM
public static final int LEFT
public static final int RIGHT
public static final int CENTER
public static final int SMART
Constructor Detail |
public Axes()
public Axes(java.lang.String xLabel, java.lang.String yLabel)
xlabel
- Label for x axis. If the value is null, no label is drawn.ylabel
- Label for y axis. If the value is null, no label is drawn.Method Detail |
public java.awt.Color getAxesColor()
public void setAxesColor(java.awt.Color c)
public java.awt.Color getLightAxesColor()
public void setLightAxesColor(java.awt.Color c)
public java.awt.Color getLabelColor()
public void setLabelColor(java.awt.Color c)
public int getXAxisPosition()
public void setXAxisPosition(int pos)
public int getYAxisPosition()
public void setYAxisPosition(int pos)
public java.lang.String getXLabel()
public void setXLabel(java.lang.String s)
public java.lang.String getYLabel()
public void setYLabel(java.lang.String s)
public void draw(java.awt.Graphics g, boolean coordsChanged)
draw
in class Drawable
edu.hws.jcm.draw.Drawable
g
- The graphics context in which the Drawble is to be drawn. (The drawing
can change the color in g, but should not permanently change font, painting mode, etc.
Thus, every drawable is responsible for setting the color it wants to use.)coordsChanged
- Indicates whether the CoordinateRect has changed.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |