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
implements HTMLHandler
JCLineStyle controls how a line is drawn. It stores the line pattern and line width, and then draws lines accordingly.

Properties

Name Description
Color The Color property determines the color used to draw a line. The default value is generated.
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.


Variable Index

 o DASH_DOT
 o linePattern_strings
 o linePattern_values
 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 drawRect(Graphics, int, int, int, int)
Performs the requested draw rect given the values of the properties of the JCLineStyle instance.
 o fillRect(Graphics, int, int, int, int)
Performs the requested fill given the values of 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 loadParams(String, JCChart)
Load JCChart parameters from HTML file
 o makeDefault(JCChart)
Creates a default line style
 o saveParams(String, HTMLSaveDriver)
Save JCChart parameters as HTML tags
 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
 o linePattern_strings
 public static final String linePattern_strings[]
 o linePattern_values
 public static final int linePattern_values[]

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 drawRect
 public void drawRect(Graphics gc,
                      int x,
                      int y,
                      int width,
                      int height)
Performs the requested draw rect given the values of the properties of the JCLineStyle instance.

Parameters:
gc - graphics context to use for drawing
x - x origin of rect region (in pixels)
y - y origin of rect region (in pixels)
width - width of rect region (in pixels)
height - height of rect region (in pixels)
 o fillRect
 public void fillRect(Graphics gc,
                      int x,
                      int y,
                      int width,
                      int height)
Performs the requested fill given the values of the properties of the JCLineStyle instance.

Parameters:
gc - graphics context to use for drawing
x - x origin of fill region (in pixels)
y - y origin of fill region (in pixels)
width - width of fill region (in pixels)
height - height of fill region (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 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 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 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.
 o saveParams
 public void saveParams(String name,
                        HTMLSaveDriver comp)
Save JCChart parameters as HTML tags

Parameters:
name - the PARAM NAME
chart - the JCChart component
 o loadParams
 public void loadParams(String name,
                        JCChart comp)
Load JCChart parameters from HTML file

Parameters:
name - the PARAM NAME
chart - the JCChart component

All Packages  Class Hierarchy  This Package  Previous  Next  Index