// general form of an applet public class Fred extends JApplet { public void init() { // create the GUI, get images, etc. Container contentPane = getContentPane(); // remember to put your components in the contentPane } // init } // Fred **************************************************************** **************************************************************** // general form of an application class Fred extends JFrame { public Fred() { // create the GUI, get images, etc. Container contentPane = getContentPane(); setSize(600, 800); // remember to put your components in the contentPane } // constructor public static void main(String [] args) { Fred i = new Fred(); // choose more meaningful name i.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } // windowClosing }); i.pack(); i.setVisible(true); } // main } // Fred **************************************************************** **************************************************************** // general form of a class that is both public class Fred extends JApplet { boolean inAnApplet = true; public void init() { // create the GUI, get images, etc. Container contentPane = getContentPane(); // remember to put your components in the contentPane } // init public static void main(String [] args) { JFrame i = new JFrame(); // choose more meaningful names Fred j = new Fred(); i.setSize(500, 600); i.addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } // windowClosing }); j.inAnApplet = false; j.init(); j.start(); // only do this if you overrode the start method i.getContentPane().add(j); i.pack(); i.setVisible(true); } // main } // Fred