Any object that has an SFX
property can use special effects. The objects that
have the SFX
property are:
Plot area, pie frame, and the three-dimensional frame-- The BaseFrame
class is the superclass of the PlotArea
, the PieFrame
,
and the components that comprise the three-dimensional version of a plot
area: ThreeDLeftWall
, ThreeDRightWall
, and ThreeDFloor
.
The legend area
The background of the graph
The Graph bean supports the following kinds of special effects:
Gradients -- Gradients fade from one color to another.
Textures -- Textures are images. They can look like a texture that covers an area, or they can be a picture that appears once or is repeated.
To specify the type of special effect that you want to use, you call the
setFillType
method of the SFX
object. For example, the following
code specifies the use of a gradient for the plot area:
PlotArea plot = myGraph.getPlotArea(); plot.getSFX().setFillType(BaseGraphComponent.FT_GRADIENT); //other gradient properties also need to be set
To use a basic color instead of a gradient or texture, set the FillType
property
of the SFX
object to BaseGraphComponent.FT_COLOR
. The color that
appears is specified by the FillColor
property of the object. The following code
specifies a color for the plot area and turns off any special effect that has been set.
PlotArea plot = myGraph.getPlotArea(); // the previously set color will be used; if you want to change // the color, then use a call like the following // plot.setFillColor(Color.pink); plot.getSFX().setFillType(BaseGraphComponent.FT_COLOR);