public class Axes extends Drawable
Modifier and Type | Field and Description |
---|---|
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.
|
Constructor and Description |
---|
Axes()
Creates axes with no names on the axes.
|
Axes(String xLabel,
String yLabel)
Creates axes with given names on the axes.
|
Modifier and Type | Method and Description |
---|---|
void |
draw(Graphics g,
boolean coordsChanged)
Draw the axes.
|
Color |
getAxesColor()
Get the color that is used for drawing the axes, when they are drawn in their true position.
|
Color |
getLabelColor()
Get the color that is used for drawing the labels on the x- and y-axes.
|
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.
|
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.
|
String |
getYLabel()
Get the label that appears on the y-axis.
|
void |
setAxesColor(Color c)
Set the color that is used for drawing the axes, when they are drawn in their true position.
|
void |
setLabelColor(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(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(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(String s)
Set the label that appears on the y-axis.
|
getVisible, needsRedraw, setOwnerData, setVisible
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
public Color getAxesColor()
public void setAxesColor(Color c)
public Color getLightAxesColor()
public void setLightAxesColor(Color c)
public Color getLabelColor()
public void setLabelColor(Color c)
public int getXAxisPosition()
public void setXAxisPosition(int pos)
public int getYAxisPosition()
public void setYAxisPosition(int pos)
public String getXLabel()
public void setXLabel(String s)
public String getYLabel()
public void setYLabel(String s)
public void draw(Graphics g, boolean coordsChanged)
draw
in class 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.