Applet Browser Display Problem

Hello, I'm a student learning java, I'm on my final assignment and came across a confusing problem,my applet won't display in my browser, although when I compile it, I get no errors.

Here's my code for anyone who can help.

import java.applet.Applet;

import java.awt.*;

import java.awt.event.*;

publicclass surveyappletextends Appletimplements ActionListener{

ageSurvey Panel1;

Options Panel2;

publicvoid init(){

setLayout(new GridLayout(10,20));

Panel1 =new ageSurvey();

Panel2 =new Options();

add(Panel1);

Panel1.inputage.addActionListener(this);

Panel1.thebutton.addActionListener(this);

Panel1.thebutton.addActionListener(this);

add(Panel2);

}

publicvoid actionPerformed(ActionEvent event){

String text = Panel1.inputage.getText();

if (event.getSource() == Panel1.thebutton){

Panel2.outputage.setText(String.valueOf(text));

}

if (Integer.parseInt(text) < 21){

Panel2.Option1.setState(true);

Panel2.Option2.setState(true);

Panel2.Option3.setState(false);

Panel2.Option4.setState(false);

Panel2.Option5.setState(true);

Panel2.Option6.setState(false);

Panel2.outputage.setText("likes to run, likes toys and eats burgers.");

}

if (Integer.parseInt(text) > 21 && Integer.parseInt(text) < 35){

Panel2.Option1.setState(true);

Panel2.Option2.setState(true);

Panel2.Option3.setState(false);

Panel2.Option4.setState(false);

Panel2.Option5.setState(true);

Panel2.Option6.setState(false);

Panel2.outputage.setText("likes to run, eats burgers and likes toys.");

}

if (Integer.parseInt(text) > 36 && Integer.parseInt(text) < 60){

Panel2.Option1.setState(false);

Panel2.Option2.setState(true);

Panel2.Option3.setState(true);

Panel2.Option4.setState(true);

Panel2.Option5.setState(true);

Panel2.Option6.setState(false);

Panel2.outputage.setText("needs reading glasses, eats burgers likes to sit and likes toys.");

}

if (Integer.parseInt(text) > 60){

Panel2.Option1.setState(false);

Panel2.Option2.setState(false);

Panel2.Option3.setState(true);

Panel2.Option4.setState(true);

Panel2.Option5.setState(false);

Panel2.Option6.setState(true);

Panel2.outputage.setText("eats prunes, likes to sit and needs reading glasses.");

}

}

class ageSurveyextends Panel{

Label age;

TextField inputage;

Button thebutton;

ageSurvey(){

age =new Label("please enter age");

add(age);

inputage =new TextField(20);

add(inputage);

thebutton =new Button("Click Here!");

add(thebutton);

}

}

class Optionsextends Panel{

Checkbox Option1, Option2, Option3, Option4, Option5, Option6;

TextField outputage;

Options(){

add(Option1 =new Checkbox("likes to run"));

add(Option2 =new Checkbox("eats burgers"));

add(Option3 =new Checkbox("needs reading glasses"));

add(Option4 =new Checkbox("likes to sit"));

add(Option5 =new Checkbox("likes toys"));

add(Option6 =new Checkbox("eats prunes"));

outputage =new TextField(30);

add(outputage);

}

}

}

Thanks in advance for anyone with a solution.

[6372 byte] By [alvinsanchez.coma] at [2007-11-27 8:57:22]
# 1

I've figured out the problem.

the lesson:

make sure you have all your class files in the same folder thatyour html file will be referencing.

in my situtation, when I compiled, it created three .class files, and I only had the main .class file in the folder my html file was referencing, not all three of them.

alvinsanchez.coma at 2007-7-12 21:21:50 > top of Java-index,Java Essentials,New To Java...