|
JClass DesktopViews 6.3.0 API Documentation |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.klg.jclass.chart.JCStyle | +--com.klg.jclass.chart.JCLineStyle
JCLineStyle
controls how a line is drawn. It stores
the line pattern and line width, and then
draws lines accordingly.
Field Summary | |
protected int |
cap
|
protected Color |
color
|
protected int |
colorIndex
|
static int |
CUSTOM
|
static int |
DASH_DOT
|
static float[] |
DASH_DOT_ARRAY
|
protected float[] |
dashArray
|
protected int |
join
|
static float[] |
LEGEND_DASH_DOT_ARRAY
|
static float[] |
LEGEND_LONG_DASH_ARRAY
|
static float[] |
LEGEND_LSL_DASH_ARRAY
|
static float[] |
LEGEND_SHORT_DASH_ARRAY
|
protected float[] |
legendDashArray
|
static int |
LONG_DASH
|
static float[] |
LONG_DASH_ARRAY
|
static int |
LSL_DASH
|
static float[] |
LSL_DASH_ARRAY
|
static int |
NONE
|
protected int |
pattern
|
static int |
SHORT_DASH
|
static float[] |
SHORT_DASH_ARRAY
|
static int |
SOLID
|
protected int |
width
|
protected int[] |
xp
|
protected int[] |
yp
|
Fields inherited from class com.klg.jclass.chart.JCStyle |
defaultColors, parent |
Constructor Summary | |
JCLineStyle(int w,
Color c,
int p)
Constructor for line style objects. |
|
JCLineStyle(int w,
Color c,
int p,
int cp,
int j)
Full Constructor for line style objects. |
|
JCLineStyle(int w,
Color c,
int p,
int cp,
int j,
float[] da,
float[] dla)
Full Constructor for line style objects. |
Method Summary | |
void |
draw(Graphics gc,
int x1,
int y1,
int x2,
int y2)
Draws a line between two points according to the the properties of this line style. |
void |
draw(Graphics gc,
int x1,
int y1,
int x2,
int y2,
Color col)
Draws a line between two points according to the the properties of this line style, except that the color is overridden with the specified color. |
void |
drawArc(Graphics gc,
double x,
double y,
double width,
double height,
double startAngle,
double arcAngle)
|
void |
drawCircle(Graphics gc,
int xCenter,
int yCenter,
int radius)
Performs the requested draw circle operation given the properties of the JCLineStyle instance. |
void |
drawLine(Graphics gc,
double x1,
double y1,
double x2,
double y2)
|
void |
drawLine(Graphics gc,
int x1,
int y1,
int x2,
int y2)
Draws a line between two points according to the given Graphics
object (it must already be set with the appropriate drawing attributes). |
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. |
void |
drawSquaredLine(Graphics gc,
int x1,
int y1,
int x2,
int y2,
boolean horizOrVert,
int delta,
int min,
int max)
Draws a squared line between two points according to the given Graphics object (it must already be set with the appropriate
drawing attributes). |
boolean |
equals(Object obj)
Override the equals method of class Object. |
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. |
int |
getCap()
Gets the Cap property, which dictates the cap style to use at
the ends of a line. |
Color |
getColor()
Gets the Color property of JCLineStyle , which
determines the color used to draw the line. |
int |
getColorIndex()
Returns the index used to generate the color. |
float[] |
getCustomLegendPatternArray()
Returns the custom legend pattern array used for dashed lines if one has been set by the setPattern(float[], float[]) method. |
float[] |
getCustomPatternArray()
Returns the custom pattern array used for dashed lines if one has been set by the setPattern(float[], float[]) method. |
int |
getJoin()
Gets the Join property, which dictates the join style to use
when joining two lines. |
int |
getPattern()
Gets the Pattern property, which dictates the pattern
used to draw a line. |
int |
getWidth()
Gets the Width property, which controls line width. |
int |
hashCode()
Override the hashCode method of class Object. |
static com.klg.jclass.chart.JCLineStyle |
makeDefault(com.klg.jclass.chart.JCChart c)
Creates a default line style. |
void |
resetGraphics(Graphics gc)
Resets the graphics object to a default drawing style. |
void |
setCap(int c)
Sets the Cap property, which dictates the cap style to use at
the ends of a line. |
void |
setColor(Color clr)
Sets the Color property of JCLineStyle , which
determines the color used to draw the line. |
void |
setJoin(int j)
Sets the Join property, which dictates the join style to use
when joining two lines. |
void |
setPattern(float[] patternArray,
float[] legendPatternArray)
Sets the Pattern property, which dictates the pattern
used to draw a line, with a custom user-defined pattern. |
void |
setPattern(int p)
Sets the Pattern property, which dictates the pattern
used to draw a line. |
void |
setWidth(int w)
Sets the Width property, which controls line width. |
boolean |
updateGraphics(Graphics gc)
Updates the Graphics object with the elements of this line style
(strokes and colors). |
boolean |
updateGraphics(Graphics gc,
int drawLineLength)
Updates the Graphics object with the elements of this line style
(strokes and colors). |
Methods inherited from class com.klg.jclass.chart.JCStyle |
getDefaultColors, setDefaultColors |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected int join
protected int cap
protected int pattern
protected int width
protected int colorIndex
protected Color color
public static final int NONE
public static final int SOLID
public static final int LONG_DASH
public static final int SHORT_DASH
public static final int LSL_DASH
public static final int DASH_DOT
public static final int CUSTOM
public static final float[] LONG_DASH_ARRAY
public static final float[] SHORT_DASH_ARRAY
public static final float[] LSL_DASH_ARRAY
public static final float[] DASH_DOT_ARRAY
public static final float[] LEGEND_LONG_DASH_ARRAY
public static final float[] LEGEND_SHORT_DASH_ARRAY
public static final float[] LEGEND_LSL_DASH_ARRAY
public static final float[] LEGEND_DASH_DOT_ARRAY
protected float[] dashArray
protected float[] legendDashArray
protected int[] xp
protected int[] yp
Constructor Detail |
public JCLineStyle(int w, Color c, int p)
w
- line widthc
- line colorp
- line pattern. One of NONE
, SOLID
,
LONG_DASH
, LSL_DASH
, or DASH_DOT
.public JCLineStyle(int w, Color c, int p, int cp, int j)
w
- line widthc
- line colorp
- line pattern. One of NONE
, SOLID
,
LONG_DASH
, LSL_DASH
, or DASH_DOT
.cp
- cap valuej
- join valuepublic JCLineStyle(int w, Color c, int p, int cp, int j, float[] da, float[] dla)
w
- line widthc
- line colorp
- line pattern. One of NONE
, SOLID
,
LONG_DASH
, LSL_DASH
, or DASH_DOT
.cp
- cap valuej
- join valueda
- array of floats specifying custom dashed line patterndla
- array of floats specifying custom dashed line pattern for legendMethod Detail |
public static com.klg.jclass.chart.JCLineStyle makeDefault(com.klg.jclass.chart.JCChart c)
c
-
JCLineStyle
object with default width, color, and
pattern. The defaults are cycled, so consecutive calls
will return different line styles.public boolean updateGraphics(Graphics gc)
Graphics
object with the elements of this line style
(strokes and colors).
gc
- Graphics
object to change
true
if you should now use this object to draw;
false
if the style is such that no drawing should occurpublic boolean updateGraphics(Graphics gc, int drawLineLength)
Graphics
object with the elements of this line style
(strokes and colors). This method scales the dashed lines of the stroke down
for small line lengths, such as need to be drawn in the legend.
gc
- Graphics
object to changedrawLineLength
- maximum length of line to be drawn in pixels. Used to
scale dashed lines down such that the line will be drawn with the
appropriate pattern.
true
if you should now use this object to draw;
false
if the style is such that no drawing should occurpublic void resetGraphics(Graphics gc)
gc
- Graphics
object to changepublic void draw(Graphics gc, int x1, int y1, int x2, int y2)
gc
- graphics context to use for drawingx1
- 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)public void draw(Graphics gc, int x1, int y1, int x2, int y2, Color col)
gc
- graphics context to use for drawingx1
- 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)col
- overriding colorpublic void drawLine(Graphics gc, int x1, int y1, int x2, int y2)
Graphics
object (it must already be set with the appropriate drawing attributes).
gc
- graphics context to use for drawingx1
- 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)public void drawLine(Graphics gc, double x1, double y1, double x2, double y2)
public void drawSquaredLine(Graphics gc, int x1, int y1, int x2, int y2, boolean horizOrVert, int delta, int min, int max)
Graphics
object (it must already be set with the appropriate
drawing attributes). A squared line is one that, when angled and having a
width greater than 1, will square off the edges to the appropriate vertical
or horizontal.
gc
- 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)horizOrVert
- is this a vertically oriented (false
) or
horizontally oriented (true
) line?delta
- the delta value for 3D calculations in the orientation directionmin
- the minimum value to clip against in the orientation directionmax
- the maximum value to clip against in the orientation directionpublic void drawRect(Graphics gc, int x, int y, int width, int height)
JCLineStyle
instance.
gc
- graphics context to use for drawingx
- 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)public void fillRect(Graphics gc, int x, int y, int width, int height)
JCLineStyle
instance.
gc
- graphics context to use for drawingx
- 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)public void drawCircle(Graphics gc, int xCenter, int yCenter, int radius)
JCLineStyle
instance.
gc
- graphics context to use for drawingxCenter
- x coordinate of center (in pixels)yCenter
- y coordinate of center (in pixels)radius
- radius of circle (in pixels)public void drawArc(Graphics gc, double x, double y, double width, double height, double startAngle, double arcAngle)
public int getPattern()
Pattern
property, which dictates the pattern
used to draw a line.
NONE
, SOLID
, LONG_DASH
,
SHORT_DASH
, LSL_DASH
, or DASH_DOT
public void setPattern(int p)
Pattern
property, which dictates the pattern
used to draw a line.
p
- one of NONE
, SOLID
,
LONG_DASH
, SHORT_DASH
, LSL_DASH
, or
DASH_DOT
IllegalArgumentException
- If the patter is not one of
NONE
, SOLID
, LONG_DASH
,
SHORT_DASH
, LSL_DASH
, or DASH_DOT
.public void setPattern(float[] patternArray, float[] legendPatternArray)
Pattern
property, which dictates the pattern
used to draw a line, with a custom user-defined pattern.
The pattern type is automatically set to CUSTOM
.
patternArray
- an array of floats representing the pattern to use
when drawing this linelegendPatternArray
- An array of floats representing the pattern to
use when drawing this line in the legend. (Usually, this means
taking the pattern array and cutting the values down. Half workss
well, unless the values get too small, in which case nothing will
be drawn.)public float[] getCustomPatternArray()
setPattern(float[], float[])
method.
public float[] getCustomLegendPatternArray()
setPattern(float[], float[])
method.
public int getWidth()
Width
property, which controls line width.
public void setWidth(int w)
Width
property, which controls line width.
w
- positive integer representing line widthpublic Color getColor()
Color
property of JCLineStyle
, which
determines the color used to draw the line.
Graphics
object is used.public void setColor(Color clr)
Color
property of JCLineStyle
, which
determines the color used to draw the line.
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.public int getColorIndex()
public int getJoin()
Join
property, which dictates the join style to use
when joining two lines.
BasicStroke.JOIN_MITER
,
BasicStroke.JOIN_BEVEL
, or BasicStroke.JOIN_ROUND
public void setJoin(int j)
Join
property, which dictates the join style to use
when joining two lines.
j
- one of BasicStroke.JOIN_MITER
,
BasicStroke.JOIN_BEVEL
, or BasicStroke.JOIN_ROUND
public int getCap()
Cap
property, which dictates the cap style to use at
the ends of a line. Used in jdk 1.2 only.
BasicStroke.CAP_BUTT
,
BasicStroke.CAP_ROUND
, or BasicStroke.CAP_SQUARE
public void setCap(int c)
Cap
property, which dictates the cap style to use at
the ends of a line. Used in jdk 1.2 only.
c
- of BasicStroke.CAP_BUTT
,
BasicStroke.CAP_ROUND
, or BasicStroke.CAP_SQUARE
.public boolean equals(Object obj)
equals
in class Object
public int hashCode()
hashCode
in class Object
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |