Re: Applet code conversion...

Discussion in 'Java' started by Jeff Higgins, Apr 30, 2012.

  1. Jeff Higgins

    Jeff Higgins Guest

    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);
    }
    });
    }
    }
     
    Jeff Higgins, Apr 30, 2012
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Rob Love

    applet vs. canvas in applet

    Rob Love, Jul 7, 2003, in forum: Java
    Replies:
    1
    Views:
    653
    Liu, Chunyen
    Jul 7, 2003
  2. Rune Andresen
    Replies:
    2
    Views:
    1,974
    Phil Powell
    Sep 17, 2003
  3. Lew
    Replies:
    3
    Views:
    546
    Knute Johnson
    May 3, 2012
  4. Tsukino Usagi

    Re: Applet code conversion...

    Tsukino Usagi, Apr 30, 2012, in forum: Java
    Replies:
    0
    Views:
    410
    Tsukino Usagi
    Apr 30, 2012
  5. Roedy Green

    Re: Applet code conversion...

    Roedy Green, Apr 30, 2012, in forum: Java
    Replies:
    0
    Views:
    385
    Roedy Green
    Apr 30, 2012
Loading...

Share This Page