org.faceless.graph2
Class Style

java.lang.Object
  extended by org.faceless.graph2.Style

public final class Style
extends Object

This class represents a style used to draw a graphic object, such as a bar, a line or the graph key. To control the font and layout of text, see the TextStyle class


Constructor Summary
Style(Paint color)
          Create a new Style
Style(Style style)
          Create a new Style that's a clone of the specified style
 
Method Summary
static Paint createPattern(String name, Color foreground, Color background)
          Create a TexturePaint object from one of several predefined patterns.
 boolean equals(Object o)
           
 int hashCode()
           
 void setBorderColor(Color color)
          Set the border color for this style
 void setColor(Paint color)
          Set the color of this style
 void setLineDash(double[] dash)
          Set the line dashing for this style.
 void setLineThickness(double thick)
          Set the line thickness for this style.
 String toString()
           
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Style

public Style(Paint color)
Create a new Style

Parameters:
color - the color to use

Style

public Style(Style style)
Create a new Style that's a clone of the specified style

Method Detail

setColor

public void setColor(Paint color)
Set the color of this style

Parameters:
color - the color to use

setBorderColor

public void setBorderColor(Color color)
Set the border color for this style

Parameters:
color - the color to use to draw borders in this style, or null not to draw any borders

setLineThickness

public void setLineThickness(double thick)
Set the line thickness for this style. 1 is the default, 0.5 is half as thick, and so on.

Parameters:
thick - the line thickness of this style. Must be > 0

setLineDash

public void setLineDash(double[] dash)
Set the line dashing for this style. The "dash" parameter is an array of 2*n values, where the first in each pair is the length of the dash, the second is the length of the space. So, for example, setLineDash(new double[] { 5, 5 }) would create a regular dash pattern of 5 on, 5 off, and setLineDash(new double[] { 6, 2, 2, 2 }) would create a dash-dot type pattern. To turn dashing off completely, pass in a zero length array or null.

Parameters:
dash - an array of doubles which must be even in length and have every value >0
Throws:
IllegalArgumentException - if the array is odd in length or if it contains any values <= 0

toString

public String toString()
Overrides:
toString in class Object

equals

public boolean equals(Object o)
Overrides:
equals in class Object

hashCode

public int hashCode()
Overrides:
hashCode in class Object

createPattern

public static Paint createPattern(String name,
                                  Color foreground,
                                  Color background)
Create a TexturePaint object from one of several predefined patterns. These may be used for tiling paints - useful in environments where color is limited to black and white. The available patterns are:

bricks circles crosshatch crosshatch30 crosshatch45 fishscales gray0 gray10 gray15 gray20 gray25 gray30 gray35 gray40 gray45 gray5 gray50 gray55 gray60 gray65 gray70 gray75 gray80 gray85 gray90 gray95 hexagons horizontal horizontalsaw hs_bdiagonal hs_cross hs_diagcross hs_fdiagonal hs_horizontal hs_vertical left30 left45 leftshingle octagons right30 right45 rightshingle scatter1 scatter2 smallfishscales vertical verticalbricks verticalleftshingle verticalrightshingle verticalsaw weave

Alternatively the full URL of a PBM format image may be specified.

Parameters:
name - the name or URL of the pattern to use.
foreground - the foreground color. May be null, in which case it defaults to black.
background - the background color. May be null, in which case it defaults to white.
Since:
2.1.1


Copyright © 2001-2007 Big Faceless Organization