Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   Java (http://www.velocityreviews.com/forums/f30-java.html)
-   -   Re: Applet code conversion... (http://www.velocityreviews.com/forums/t945846-re-applet-code-conversion.html)

Jeff Higgins 04-30-2012 10:06 AM

Re: Applet code conversion...
 
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);
}
});
}
}


All times are GMT. The time now is 11:30 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.