All Packages Class Hierarchy This Package Previous Next Index
Class jclass.chart.JCLineStyle
java.lang.Object
|
+----jclass.chart.JCStyle
|
+----jclass.chart.JCLineStyle
- public class JCLineStyle
- extends JCStyle
JCLineStyle controls how a line is drawn. It stores
the line pattern and line width, and then
draws lines accordingly.
Properties
Name |
Method |
Pattern
|
The Pattern property dictates the pattern used to draw a line. Valid
values include JCLineStyle.NONE, JCLineStyle.SOLID,
JCLineStyle.LONG_DASH, JCLineStyle.SHORT_DASH, JCLineStyle.LSL_DASH
and JCLineStyle.DASH_DOT. Note: Since Java does not support line
patterns, this property is currently not supported. The default value is JCLineStyle.SOLID.
|
Width
|
The Width property controls the line width. Note: Since Java only
supports width-1 lines, this property is currently not supported. The default value is 1.
|
Color
|
The Color property determines the color used to draw a line. The default value is generated.
|
-
DASH_DOT
-
-
LONG_DASH
-
-
LSL_DASH
-
-
NONE
-
-
SHORT_DASH
-
-
SOLID
-
-
JCLineStyle(int, Color, int)
- Constructor for line style objects.
-
draw(Graphics, int, int, int, int)
- Draws a line between two points according to the properties
of the JCLineStyle instance.
-
getColor()
- Gets the Color property of JCLineStyle, which determines the
color used to draw the line.
-
getPattern()
- Gets the Pattern property, which dictates the pattern
used to draw a line.
-
getWidth()
- Gets the Width property, which controls line width.
-
makeDefault(JCChart)
- Creates a default line style
-
setColor(Color)
- Sets the Color property of JCLineStyle, which determines the
color used to draw the line.
-
setPattern(int)
- Sets the Pattern property, which dictates the pattern
used to draw a line.
-
setWidth(int)
- Sets the Width property, which controls line width.
NONE
public final static int NONE
SOLID
public final static int SOLID
LONG_DASH
public final static int LONG_DASH
SHORT_DASH
public final static int SHORT_DASH
LSL_DASH
public final static int LSL_DASH
DASH_DOT
public final static int DASH_DOT
JCLineStyle
public JCLineStyle(int w,
Color c,
int p)
- Constructor for line style objects.
- Parameters:
- w - line width
- c - line color
- p - line pattern. One of NONE, SOLID, LONG_DASH,
LSL_DASH or DASH_DOT.
makeDefault
public static JCLineStyle makeDefault(JCChart c)
- Creates a default line style
- Returns:
- JCLineStyle object with default width, color and
pattern. The defaults are cycled, so consecutive calls
will return different line styles.
draw
public void draw(Graphics gc,
int x1,
int y1,
int x2,
int y2)
- Draws a line between two points according to the properties
of the JCLineStyle instance.
- Parameters:
- gr - graphics context to use for drawing.
- x1 - x value of first point (in pixels)
- y1 - y value of first point (in pixels)
- x2 - x value of second point (in pixels)
- y2 - y value of second point (in pixels)
getPattern
public int getPattern()
- Gets the Pattern property, which dictates the pattern
used to draw a line.
- Returns:
- one of NONE, SOLID, LONG_DASH, SHORT_DASH,
LSL_DASH or DASH_DOT
setPattern
public synchronized void setPattern(int p)
- Sets the Pattern property, which dictates the pattern
used to draw a line.
- Parameters:
- p - one of NONE, SOLID, LONG_DASH, SHORT_DASH,
LSL_DASH or DASH_DOT
- Throws: IllegalArgumentException
- If the patter is not one of
NONE, SOLID, LONG_DASH, SHORT_DASH, LSL_DASH or DASH_DOT.
getWidth
public int getWidth()
- Gets the Width property, which controls line width.
- Returns:
- positive integer representing line width
setWidth
public synchronized void setWidth(int w)
- Sets the Width property, which controls line width.
- Parameters:
- w - positive integer representing line width
getColor
public Color getColor()
- Gets the Color property of JCLineStyle, which determines the
color used to draw the line.
- Returns:
- AWT Color class representing the color to be used
to draw the lines. If null, the current color of the Graphics
object is used.
setColor
public synchronized void setColor(Color clr)
- Sets the Color property of JCLineStyle, which determines the
color used to draw the line.
- Parameters:
- clr - AWT Color class representing the color to be used
to draw the lines. If null, the current color of the Graphics
object is used.
All Packages Class Hierarchy This Package Previous Next Index