I think that the problem is in init(), since Client() is a JApplet not Jframe
I send you a code that works, analyze it
public class AppletTest extends JApplet {
JFrame j = null;
public void init() {
j = new MyFrame();
j.setVisible(true);
}
}
class MyFrame extends JFrame implements ActionListener {
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 MyFrame() {
setLayout(new BorderLayout());
setJMenuBar(menuBar);
menuBar.add(file);
file.add(home);
home.addActionListener(this);
panel.add(intro);
pack();
}
public void actionPerformed(ActionEvent e) {
Object s = e.getSource();
if (s == home) {
intro.setText("Once again, welcome!");
}
}
}