Convert my application
I have an application with a separate GUI class which creates a JFrame with all the command buttons and has methods for getting input values. I want to keep this class as it is and make an applet that displays a start button and when users press this button it creates a new GUI object and displays my JFrame. I can't seem to make this work. Even this simple test program doesn't work:
import javax.swing.*;
import java.awt.event.*;
publicclass AppletMainextends JAppletimplements ActionListener{
JButton startButton;
JPanel panel;
JFrame frame;
publicvoid init(){
startButton =new JButton("Now");
add(startButton);
startButton.addActionListener(this);
}
publicvoid actionPerformed(ActionEvent e){
panel =new JPanel();
panel.add(new JLabel("Test"));
frame =new JFrame("Test");
frame.getContentPane().add(panel);
frame.setSize(200,200);
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame.setVisible(true);
}
}
What am I doing wrong?

