public class Box extends Figure
Constructor and Description |
---|
Box(Coordinate start,
Coordinate end)
Constructor
|
Box(Coordinate start,
Coordinate end,
PathInfo info)
Constructor
|
Box(long startTime,
double startValue,
long endTime,
double endValue)
Constructor.
|
Box(long startTime,
double startValue,
long endTime,
double endValue,
PathInfo info)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
boolean |
contains(double x,
double y,
DrawContext ctx)
Returns true if the box contains the given x and y coordinates within the given draw context.
|
void |
draw(java.awt.Graphics2D gc,
DrawContext ctx)
Draws the box (this is called by the study framework).
|
long |
getEndTime()
Gets the time of the ending location of the box.
|
double |
getEndValue()
Gets the value of the ending location of the box.
|
java.awt.Color |
getFillColor()
Gets the color for drawing the box fill (null for no fill).
|
java.awt.Color |
getLineColor()
Gets the color for drawing the box outline.
|
long |
getStartTime()
Gets the time of the starting location of the box.
|
double |
getStartValue()
Gets the value of the starting location of the box.
|
java.awt.Stroke |
getStroke()
Gets the stroke for displaying the box outline.
|
boolean |
isVisible(DrawContext ctx)
Returns true if the box is currently visible within the given draw context.
|
void |
layout(DrawContext ctx)
Lays out the box by converting the start and end coordinates to x,y
coordinates on the graph.
|
void |
setEnd(long time,
double value)
Sets the location of the end of the box.
|
void |
setFillColor(java.awt.Color color)
Sets the color for drawing the box fill (null for no fill).
|
void |
setLineColor(java.awt.Color color)
Sets the color of the line used to draw the box outline.
|
void |
setStart(long time,
double value)
Sets the location of the start of the box.
|
void |
setStroke(java.awt.Stroke stroke)
Sets the stroke for displaying the box outline.
|
public Box(Coordinate start, Coordinate end)
start
- starting location of the boxend
- ending location of the boxpublic Box(Coordinate start, Coordinate end, PathInfo info)
start
- starting location of the boxend
- ending location of the boxinfo
- describes how to display the outline of the box.public Box(long startTime, double startValue, long endTime, double endValue)
startTime
- startValue
- endTime
- endValue
- public Box(long startTime, double startValue, long endTime, double endValue, PathInfo info)
startTime
- startValue
- endTime
- endValue
- info
- public void setStart(long time, double value)
time
- time (as milliseconds since 1970)value
- (y coordinate)public long getStartTime()
public double getStartValue()
public void setEnd(long time, double value)
time
- time (as milliseconds since 1970)value
- (y coordinate)public long getEndTime()
public double getEndValue()
public java.awt.Color getLineColor()
public void setLineColor(java.awt.Color color)
color
- box outline colorpublic java.awt.Color getFillColor()
public void setFillColor(java.awt.Color color)
color
- box fill colorpublic void setStroke(java.awt.Stroke stroke)
stroke
- public java.awt.Stroke getStroke()
public boolean isVisible(DrawContext ctx)
public boolean contains(double x, double y, DrawContext ctx)
public void layout(DrawContext ctx)
public void draw(java.awt.Graphics2D gc, DrawContext ctx)