Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    Regular Coder ohgod's Avatar
    Join Date
    Jun 2008
    Location
    Ohio
    Posts
    579
    Thanks
    6
    Thanked 69 Times in 69 Posts

    Java to Java applet

    Hey guys, I haven't fiddled with Java much and I'm looking for a couple quick pointers.

    If I have a small Java program, how hard is it to convert it to a Java applet that I can include in a web page?

    I looked around in this section and didn't see a tutorial for what I'm hoping to do. Could anyone either lend some advice or point me in the right direction?

  • #2
    Regular Coder
    Join Date
    Jan 2009
    Location
    india
    Posts
    145
    Thanks
    0
    Thanked 5 Times in 5 Posts
    It depends on the complexity of the program you are trying to convert to applet.

    This tutorials will help you
    http://www.dgp.toronto.edu/~mjmcguff/learn/java/
    http://java.sun.com/docs/books/tutor...oyment/applet/

    Again, you may want to use IDE like NetBeans for GUI design of applets, it will simplify creation of GUI.

    ------------------
    SN Java Servlet

  • #3
    New to the CF scene
    Join Date
    Feb 2009
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    It's not very difficult
    this is the code you need

    import javax.swing.JApplet;
    import java.awt.*;

    public class NameOfApplet extends JApplet{

    //main method and everything else goes here

    /*Things to consider,
    *Applets use different method calls than console based Java commands
    *I recommend looking them up on the Java API
    *which can be found here
    *http://java.sun.com/javase/6/docs/api/
    */

    public void paint(Graphics page){
    page.setColor(Color.blue);
    page.drawString("Good luck! ", getWidth()/2, getHeight()/2 );
    }
    }

  • #4
    Regular Coder
    Join Date
    Jan 2009
    Location
    india
    Posts
    145
    Thanks
    0
    Thanked 5 Times in 5 Posts
    It's not that easy, handling user inputs,outputs displaying GUI, lots of modification may be required. just copy-paste won't work


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •