1
package Templates.Bluej;
7
* Class __NAME__ - write a description of the class here
10
* @version (a version number)
12
public class $CLASSNAME extends JApplet {
13
// instance variables - replace the example below with your own
17
* Called by the browser or applet viewer to inform this JApplet that it
18
* has been loaded into the system. It is always called before the first
19
* time that the start method is called.
22
// this is a workaround for a security conflict with some browsers
23
// including some versions of Netscape & Internet Explorer which do
24
// not allow access to the AWT system event queue which JApplets do
25
// on startup to check access. May not be necessary with your browser.
26
JRootPane rootPane = this.getRootPane();
27
rootPane.putClientProperty("defeatSystemEventQueueCheck", Boolean.TRUE);
29
// provide any initialisation necessary for your JApplet
33
* Called by the browser or applet viewer to inform this JApplet that it
34
* should start its execution. It is called after the init method and
35
* each time the JApplet is revisited in a Web page.
38
// provide any code requred to run each time
39
// web page is visited
43
* Called by the browser or applet viewer to inform this JApplet that
44
* it should stop its execution. It is called when the Web page that
45
* contains this JApplet has been replaced by another page, and also
46
* just before the JApplet is to be destroyed.
49
// provide any code that needs to be run when page
50
// is replaced by another page or before JApplet is destroyed
54
* Paint method for applet.
56
* @param g the Graphics object for this applet
58
public void paint(Graphics g) {
59
// simple text displayed on applet
60
g.setColor(Color.white);
61
g.fillRect(0, 0, 200, 100);
62
g.setColor(Color.black);
63
g.drawString("Sample Applet", 20, 20);
64
g.setColor(Color.blue);
65
g.drawString("created by BlueJ", 20, 40);
69
* Called by the browser or applet viewer to inform this JApplet that it
70
* is being reclaimed and that it should destroy any resources that it
71
* has allocated. The stop method will always be called before destroy.
73
public void destroy() {
74
// provide code to be run when JApplet is about to be destroyed.
79
* Returns information about this applet.
80
* An applet should override this method to return a String containing
81
* information about the author, version, and copyright of the JApplet.
83
* @return a String representation of information about this JApplet
85
public String getAppletInfo() {
86
// provide information about the applet
87
return "Title: \nAuthor: \nA simple applet example description. ";
92
* Returns parameter information about this JApplet.
93
* Returns information about the parameters than are understood by this JApplet.
94
* An applet should override this method to return an array of Strings
95
* describing these parameters.
96
* Each element of the array should be a set of three Strings containing
97
* the name, the type, and a description.
99
* @return a String[] representation of parameter information about this JApplet
101
public String[][] getParameterInfo() {
102
// provide parameter information about the applet
103
String paramInfo[][] = {
104
{"firstParameter", "1-10", "description of first parameter"},
105
{"status", "boolean", "description of second parameter"},
106
{"images", "url", "description of third parameter"}