Hi I was wondering why this program has an Applet come up and it says it is not initializedher it is
This program use an applet. The program chooses the number to be guessed by
selecting a random integerin the range 1 to 1000. The applet will have a label
called Guess a number between 1 and 1000 next to a JTextfield.The player will
type in the guess and then if the guess is wrong the computer will show to
high or to low in the showStatus bar and then theuser will be able to continue
guessing until the user guesses the right one.when tha happens this will show
up in the showStatus bar(Congratulations. You guessed the number!)
*/
//java packages
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import java.util.Random;
public class Guess1Applet extends JApplet implements ActionListener {
int number,//computers number
num;// users number converted to int
JLabel num1label;// label on the applet
JTextField num1field; // the users guess
// Set up Applet's GUI
public void init ()
{
// obtain content pane and set its layout to flowlayout and creates the label
Container container =getContentPane();
container.setLayout( new FlowLayout() );
num1label = new JLabel();
//creates the label and the text for the label and textfield
num1label.setText( "Guess a number between 1 and 1000:");
container.add( num1label );
num1field = new JTextField( 5 );
container.add( num1field );
//registers the applet as num1field and num2field actionlistener
num1field.addActionListener( this );
// randomly generates a number between 1 and 1000
Random random = new Random();
number = random.nextInt(1000);
//convert the users guess to int
num = Integer.parseInt( num1field.getText());
}//END method init
public void actionPerformed ( ActionEvent e )
{
while ( num != number)
{
int number = 1 + (int)(Math.random() * 1000);
if ( num == number )
showStatus( "Congratulations. You guessed the number!");
else if ( num > number )
showStatus( "to high");
else if ( num < number )
showStatus( "to low");
// obtain content pane and set its layout to flowlayout and creates the label
Container container =getContentPane();
container.setLayout( new FlowLayout() );
num1label = new JLabel();
//creates the label and the text for the label and textfield
num1label.setText( "Guess a number between 1 and 1000:");
container.add( num1label );
num1field = new JTextField( 5 );
container.add( num1field );
//registers the applet as num1field and num2field actionlistener
num1field.addActionListener( this );
// randomly generates a number between 1 and 1000
Random random = new Random();
number = random.nextInt(1000);
//convert the users guess to int
num = Integer.parseInt( num1field.getText());
}//end while
}//end actionperformed
}//end class Guess1Applet
here is the html
<html>
<applet code="GuessApplet.class" width = 450 height= 350>
</applet Started>
</html>
any suggestions thanks for the help