Java Graphics  «Prev 

Drawing text Exercise

Objective: Use the AWT Graphics class to draw text.

Instructions

Use the AWT Graphics class to create an applet named DisplayOS that draws the operating system name and version in a bold, 20-point Monospaced font. To obtain the operating system name and version as strings, use the System.getProperty() method and pass in "os.name" and "os.version".
Following is an example:

String osName = System.getProperty("os.name");

Source files

A prepared HTML file in the download file available from the Sitemap page has been supplied.
The specific HTML file for this exercise can be found in the 03-04 folder.

Exercise scoring

The full credit for this exercise is 10 points. To receive full credit, you will need to successfully create the source code for the applet.

Submit the code

In the text box below, cut and paste the source code for the DisplayOS applet. Click, Submit to submit your answer.