|
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.chart3d.JCStyle | +--com.klg.jclass.chart3d.JCLineStyle
JCLineStyle
controls how a line is drawn. It stores the line
pattern, line color, and line width, and then draws lines accordingly.
Field Summary | |
protected int |
cap
Sets the cap style. |
protected Color |
color
Sets the line color. |
protected int |
colorIndex
Sets the index into the default color array. |
static int |
CUSTOM
|
static int |
DASH_DOT
|
static float[] |
DASH_DOT_ARRAY
|
protected int |
join
Sets the join style. |
static float[] |
LEGEND_DASH_DOT_ARRAY
|
static float[] |
LEGEND_LONG_DASH_ARRAY
|
static float[] |
LEGEND_LSL_DASH_ARRAY
|
static float[] |
LEGEND_SHORT_DASH_ARRAY
|
static int |
LONG_DASH
|
static float[] |
LONG_DASH_ARRAY
|
static int |
LSL_DASH
|
static float[] |
LSL_DASH_ARRAY
|
static int |
NONE
|
protected int |
pattern
Sets the line pattern. |
static int |
SHORT_DASH
|
static float[] |
SHORT_DASH_ARRAY
|
static int |
SOLID
|
protected int |
width
Sets the line width. |
protected int[] |
xp
|
protected int[] |
yp
|
Fields inherited from class com.klg.jclass.chart3d.JCStyle |
defaultColors, FILL_STYLE, LINE_STYLE, parent, SYMBOL_STYLE |
Constructor Summary | |
JCLineStyle(int width,
Color color,
int pattern)
Constructor for line style objects. |
|
JCLineStyle(int width,
Color color,
int pattern,
int cap,
int join)
Full Constructor for line style objects. |
|
JCLineStyle(int width,
Color color,
int pattern,
int cap,
int join,
float[] dashArray,
float[] legendDashArray)
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 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 |
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). |
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[] |
getDashArray()
Returns the dash array. |
int |
getJoin()
Gets the Join property, which dictates the join style to use
when joining two lines. |
float[] |
getLegendDashArray()
Returns the legend dash array. |
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. |
static com.klg.jclass.chart3d.JCLineStyle |
makeDefault(com.klg.jclass.chart3d.JCChart3d c)
Creates a default line style. |
void |
resetGraphics(Graphics gc)
Resets the graphics object to a default drawing style. |
void |
setCap(int cap)
Sets the Cap property, which dictates the cap style to use at
the ends of a line. |
void |
setColor(Color color)
Sets the Color property of JCLineStyle , which determines the
color used to draw the line. |
void |
setJoin(int join)
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.chart3d.JCStyle |
getDefaultColors, setDefaultColors |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, 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 int[] xp
protected int[] yp
Constructor Detail |
public JCLineStyle(int width, Color color, int pattern)
width
- line widthcolor
- line colorpattern
- line pattern; one of NONE
, SOLID
,
LONG_DASH
, SHORT_DASH
, LSL_DASH
,
DASH_DOT
, or CUSTOM
public JCLineStyle(int width, Color color, int pattern, int cap, int join)
width
- line widthcolor
- line colorpattern
- line pattern; one of NONE
, SOLID
,
LONG_DASH
, SHORT_DASH
, LSL_DASH
,
DASH_DOT
, or CUSTOM
cap
- join
- public JCLineStyle(int width, Color color, int pattern, int cap, int join, float[] dashArray, float[] legendDashArray)
width
- line widthcolor
- line colorpattern
- line patterncap
- line cap stylejoin
- line join styledashArray
- line dash arraylegendDashArray
- legend dash arrayMethod Detail |
public static com.klg.jclass.chart3d.JCLineStyle makeDefault(com.klg.jclass.chart3d.JCChart3d c)
c
- the chart for which to generate the default line style
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)
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)
gc
- Graphics
object to changedrawLineLength
- Maximum length of line to be drawn in pixels. This is 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
- the graphics object to resetpublic 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 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 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)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 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
public void setPattern(float[] patternArray, float[] legendPatternArray)
Pattern
property, which dictates the pattern used to
draw a line, with a custom user-defined pattern.
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 seems to work well,
although if the values are too small nothing will be drawn.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 color)
Color
property of JCLineStyle
, which determines the
color used to draw the line.
color
- 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 join)
Join
property, which dictates the join style to use when
joining two lines.
join
- the new join stylepublic int getCap()
Cap
property, which dictates the cap style to use at
the ends of a line.
BasicStroke.CAP_BUTT
, BasicStroke.CAP_ROUND
, or
BasicStroke.CAP_SQUARE
.public void setCap(int cap)
Cap
property, which dictates the cap style to use at
the ends of a line.
cap
- public float[] getDashArray()
public float[] getLegendDashArray()
|
Copyright © 2004 Quest Software Inc.. All rights reserved. |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |