Java – Topic 26

(Intro To Applets)

 

 

TASK

 

 

QUESTION #1

Answer the following questions.  Save your work in a txt file.

 

a)      When creating an applet, which two methods do we have to implement?

b)      Which of these methods is automatically executed when the applet loads?

c)      Which of these methods is automatically executed every time the applet has to be refreshed?

d)      What type of document is used to display an applet?

 

 

QUESTION #2

Click here to see source code for an overly simple applet that draws two lines resembling an “equal” symbol.

 

a)      Make it work inside an HTML document.

b)      Are you able to figure out how to change it to make an X be drawn in the applet?

 

QUESTION #3

Click here to see an applet that displays the number of times the paint method is called.  You can download all the applet files by clicking here.

 

Try resizing and moving the window to get accustomed to how when the paint() method is called.  Examine the code to make sure you understand it.

 

GOT EXTRA TIME?

Check out the Java Boutique website for applets that are being shared with the world.  You can see both the applet and the source code for most!