Java Reference
In-Depth Information
22.
public void
setTime(
int
t){
23.
time = t;
24.
this
.repaint();
25.
}
26.
27.
28.
29.
}
File:
its/Applet/TimerApplet.java
1.
package
its.Applet;
2.
3.
import
javax.swing.JApplet;
4.
import
java.awt.BorderLayout;
5.
6.
public class
TimerApplet
extends
JApplet {
7.
8.
private
TimerThread timer;
9.
10.
public void
init(){
11.
TimerPanel timerPane =
new
TimerPanel();
12.
timer =
new
TimerThread(timerPane);
13.
this.getContentPane().add(timerPane,BorderLayout.CENTER);
14.
timer.start();
15.
}
16.
17.
public void
start(){
18.
System.out.println("Start");
19.
}
20.
21.
public void
stop(){
22.
System.out.println("Stop");
23.
}
24.
25.
public void
destroy(){
26.
System.out.println("Destroy");
27.
}
28.
}
23.1.3
Remarks
The Java SDK contains an
applet viewer
,aprogram that can display an applet
without using a browser. This is helpful when developing and testing an applet.
Search WWH ::
Custom Search