The Graphics object’s drawString method supports the output of text to the control to which the object belongs. This method writes the text to the location that you specify, as in the following example:
Graphics g = this.createGraphics();
g.drawString("Hello, World", new Point(0, 0));
The visual result of this call depends upon a host of factors, including the Graphics object’s current text color, background color, font settings, and coordinate systems.
For information on how to set the text color, see Setting Text Color. For information on associating fonts with the Graphics object, see Using the Font Object. For information about coordinate systems, see The Graphics Object Coordinate System.