Activity 2 — Zener.java listing (1) Study the example program Zener.java and answer the questions in it. (2) Compile and run the applet with the appletviewer NOTE: For the applet to work you need to have the GIF image files in the same directory as the Java source file: zennerWaves.gif zennerSquare.gif zennerCircle.gif zennerStar.gif zennerCross.gif
The screen should look similar to the following run: 
(3) Make the applet change the displayed shape, i.e. make the screen look these different ways:  

Discussion of notice the reduced yPos of the square (from the default 50) and the increased xPos of the circle (from the defalt 50) — this shows the success of the invocation of the inherited methods through the sending of the setX() and setY() messages in ShapeApplet.java . Discussion of Activity 2 Back to content Back to top 
RITSEC - Global Campus Copyright ?1999 RITSEC- Middlesex University. All rights reserved. webmaster@globalcampus.com.eg |