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.


Variable Index

 o DASH_DOT
 o LONG_DASH
 o LSL_DASH
 o NONE
 o SHORT_DASH
 o SOLID

Constructor Index

 o JCLineStyle(int, Color, int)
Constructor for line style objects.

Method Index

 o draw(Graphics, int, int, int, int)
Draws a line between two points according to the properties of the JCLineStyle instance.
 o getColor()
Gets the Color property of JCLineStyle, which determines the color used to draw the line.
 o getPattern()
Gets the Pattern property, which dictates the pattern used to draw a line.
 o getWidth()
Gets the Width property, which controls line width.
 o makeDefault(JCChart)
Creates a default line style
 o setColor(Color)
Sets the Color property of JCLineStyle, which determines the color used to draw the line.
 o setPattern(int)
Sets the Pattern property, which dictates the pattern used to draw a line.
 o setWidth(int)
Sets the Width property, which controls line width.

Variables

 o NONE
 public static final int NONE
 o SOLID
 public static final int SOLID
 o LONG_DASH
 public static final int LONG_DASH
 o SHORT_DASH
 public static final int SHORT_DASH
 o LSL_DASH
 public static final int LSL_DASH
 o DASH_DOT
 public static final int DASH_DOT

Constructors

 o 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.

Methods

 o 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.
 o 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)
 o 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
 o 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.
 o getWidth
 public int getWidth()
Gets the Width property, which controls line width.

Returns:
positive integer representing line width
 o setWidth
 public synchronized void setWidth(int w)
Sets the Width property, which controls line width.

Parameters:
w - positive integer representing line width
 o 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.
 o 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