Back to DFS's Java Page


ICS4M Java Problem Set I

Events and Simple Graphics

For this problem, you will make use of two important features of Java, events and graphics, while programming an applet.

Write a 200 x 300 applet that uses 3 buttons named "red", "blue", "yellow". and that draws a red or blue or yellow circle below the buttons when the appropriate button is pressed. Let the default button be blue.

View the following applet and its code to see how to generate graphics.
Applet Code

View the following applet and its code to see how to use buttons and events.
Applet Code


Adapted from a problem by John Ketelaars
© DFStermole 2005
Created 26 Sept 2005