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?

[1849 byte] By [phalkonea] at [2007-11-26 18:08:23]
# 1
An applet probably can't use EXIT_ON_CLOSE, although I don't know if that's the cause of your current problem.What is the problem here? Is it just failing to pop up the window? Are you getting any error messages? What's in the Java console?
paulcwa at 2007-7-9 5:40:03 > top of Java-index,Desktop,Core GUI APIs...