Howdy,
Would appreciate some help on the code below. I thought this error was brought on by missing braces etc - the compiler doesn't seem to like the Panel center = new Panel(); line. By importing java.applet.Applet I thought it would work fine.
import java.awt.*;
import java.applet.Applet;
public class NestedPanels extends Applet {
public NestedPanels () {
Panel center = new Panel(); //error happening here
// error is: 'class' or 'interface' expected Panel panel = new Panel();
center.setLayout(new BorderLayout());
center.add("South", new Button("south"));
center.add("North", new Button("north"));
center.add("East", new Button("east"));
center.add("West", new Button("west"));
center.add("Center", new Button("center"));
Panel south = new Panel();
south.setLayout(new FlowLayout());
south.add(new Button("Help"));
choice = new Choice();
choice.addItem("one");
choice.addItem("two");
choice.addItem("three");
choice.addItem("four");
choice.addItem("five");
south.add(choice);
messageBar = new Label("This is a message bar.");
south.add(messageBar);
setLayout(new BorderLayout());
add("North", new Button("North"));
add("East", new Button("East"));
add("West", new Button("West"));
add("South", south);
add("Center", center);
}
protected Label messageBar;
protected Choice choice;
}
Thanks.