Keith Gottschalk

Greenhorn
+ Follow
since Jul 28, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Keith Gottschalk

I've just found the typo. My init() method was keyed Init().
23 years ago
I give up trying to send the HTML file. Sorry.
23 years ago
Maybe you are unable to use the enter key between lines. Here at last is the HTML file. <HTML> <APPLET CODE = "LifeCycle.class" WIDTH = 450 HEIGHT = 200> </APPLET> </HTML>
23 years ago
I wonder if this forum does not like you to copy and paste.
<HTML>
<APPLET CODE = "LifeCycle.class" WIDTH = 450 HEIGHT = 200>
</APPLET>
</HTML>
23 years ago
<HTML>
<APPLET CODE = "LifeCycle.class" WIDTH = 450 HEIGHT = 200>
</APPLET>
</HTML>
23 years ago
<HTML>
<APPLET CODE = "LifeCycle.class" WIDTH = 450 HEIGHT = 200>
</APPLET>
</HTML>
23 years ago
It appears my HTML file was not included. I'll post it here.
<HTML>
<APPLET CODE = "LifeCycle.class" WIDTH = 450 HEIGHT = 200>
</APPLET>
</HTML>
23 years ago
This program simply checks to see when each method is executed. However, when I run it in an AppletViewer my applet displays absolutely nothing. Could anyone provide any suggetions? I've provided both files below. Thank you for your help.
<HTML>
<APPLET CODE = "LifeCycle.class" WIDTH = 450 HEIGHT = 200>
</APPLET>
</HTML>
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
public class LifeCycle extends Applet implements ActionListener
{
/*Declares the names of six methods that execute during
the full lifetime of the applet. Declares a button "pressButton."
Declares six integers that hold the number of occurences of each
of the six methods.*/
Font buttonFont = new Font("TimesRoman", Font.ITALIC,12);
Label messageInit = new Label("init ");
Label messageStart = new Label("start ");
Label messageDisplay = new Label("display ");
Label messageAction = new Label("action ");
Label messageStop = new Label("stop ");
Label messageDestroy = new Label("destroy");
Button pressButton = new Button("Press");
int countInit, countStart, countDisplay,
countAction, countStop, countDestroy;

/*The Init() method adds one to countInit, places
all components within the applet and calls
the display() method.*/

public void Init()
{
++countInit;
add(messageInit);
add(messageStart);
add(messageDisplay);
add(messageAction);
add(messageStop);
add(messageDestroy);
add(pressButton);
pressButton.setFont(buttonFont);
pressButton.addActionListener(this);
display();
}
//The Start() method adds one to countStart and calls the display method.

public void start()
{
++countStart;
display();
}

/*The diplay method adds one to countDisplay and displays the name of
each of the six methods with the current count and indicates how
many times the method has executed.*/

public void display()
{
++countDisplay;
messageInit.setText("Init " + countInit);
messageStart.setText("Start " + countStart);
messageDisplay.setText("display " + countDisplay);
messageAction.setText("action " + countAction);
messageStop.setText("stop " + countStop);
messageDestroy.setText("destroy " + countDestroy);
}

/*The stop() and destroy() methods each add one to the appropriate
counter and call the display() method.*/

public void stop()
{
++countStop;
display();
}
public void destroy()
{
++countDestroy;
display();
}

/*When the user clicks the button "pressButton", the following
actionPerformed() method executes. It adds one to countAction
and displays it.*/

public void actionPerformed(ActionEvent e)
{
++countAction;
display();
}
}
23 years ago