Using Special Effects in a Graph

Any object that has an SFX property can use special effects. The objects that have the SFX property are:

Types of special effects

The Graph bean supports the following kinds of special effects:

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

Turning off special effects

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);