On 04/30/2012 02:50 AM, linus wrote:
> How an applet code code can be trasformed to an application code ?
> I thought that adding a "main" would be enough .... but it is not so
> easy ! Is there an example about this my problem ?
> Thank a lot.
For the simplest case:
import java.awt.BorderLayout;
import java.awt.Frame;
import javax.swing.SwingUtilities;
import usenet.linus.MyApplet;
public class AppletFrame {
public static void main(String[] args) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
MyApplet myApplet = new MyApplet();
Frame myFrame = new Frame("Linus MyApplet Frame");
myApplet.init();
myFrame.add(myApplet, BorderLayout.CENTER);
myFrame.pack();
myFrame.setVisible(true);
}
});
}
}
|