Comparing the GraphFont and Font Objects

The GraphFont in the oracle.dss.graph package differs from the java.awt.Font object in the following ways.

Feature

GraphFont

Font

Setting properties

You can get the current GraphFont object for a component and set properties in the GraphFont.

You must create a new Font object and replace the current Font object.

Properties that you can set

Includes underlining and changing the font color

Does not include underlining or font color

To see an example of the use of the Font and the GraphFont to set font size, see Managing Font Sizes in Graphs.

Example: Setting the font color for an axis title

The following example shows how to set the color of the text in an axis title, by setting a property on the GraphFont object.


graph.getO1Title().getGraphFont().setGraphFontColor(new Color(red));