September 2011
Beginner
650 pages
15h 47m
English
Try This 14-1 A Simple Banner Applet
Banner.java
To demonstrate repaint( ), a simple banner applet is presented. This applet scrolls a message, from right to left, across the applet’s window. Since the scrolling of the message is a repetitive task, it is performed by a separate thread, created by the applet when it is initialized. Banners are popular Web features, and this project shows how to use a Java applet to create one.
1. Create a file called Banner.java.
2. Begin creating the banner applet with the following lines:

Notice that Banner extends Applet, as expected, but it also implements Runnable. This is necessary since the applet will ...
Read now
Unlock full access