I don't see whats wrong with this code. It looks fine, but the applet on the website doesn't show the gui at all
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import java.io.*;
import java.net.*;
import javax.swing.*;
public class Client extends JApplet implements ActionListener
{
public void init()
{
setContentPane(new Client());
}
public static JMenuBar menuBar = new JMenuBar();
public static JMenu file = new JMenu("File");
public static JMenuItem home = new JMenuItem("Main Page");
public static JPanel panel = new JPanel(new BorderLayout());
public static JLabel intro = new JLabel("Welcome.");
public Client() {
setLayout(new BorderLayout());
setJMenuBar(menuBar);
menuBar.add(file);
file.add(home);
home.addActionListener(this);
setLayout(new BoxLayout(panel, BoxLayout.PAGE_AXIS));
panel.add(intro);
}
public void actionPerformed(ActionEvent e) {
Object s = e.getSource();
if(s == home) {
intro.setText("Once again, welcome!");
}
}
}