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 3 of 3

Thread: Web Question

  1. #1
    Regular Coder Rappa's Avatar
    Join Date
    Nov 2005
    Location
    LI
    Posts
    356
    Thanks
    21
    Thanked 9 Times in 9 Posts

    Web Question

    Ok so i'm just starting to learn java, but im more interested in the web versions of it.

    So my question is how to I get a java applet on a web page. Like the ones that load with that little Java intro, and can be any number of things.

    I have netbeans IDE 6.0.1 with JD6

    So I know its probably a stupid question to most of you but i wanted to consult someone before starting to mess around with it.

  • #2
    New Coder
    Join Date
    Mar 2007
    Posts
    31
    Thanks
    0
    Thanked 0 Times in 0 Posts
    The HTML for putting a java applet on a webpage is:

    Code:
    <applet code="applet file here.class" widh="width" height="height"></applet>
    The structure of a java applet is:

    Code:
    import javax.swing.*;
    public class className extends JApplet {
    // set variables here
    
    public void init() {
    stuff like input fields etc is defined here
    }
    
    public void paint(Graphics screen) {
    Graphics2D screen2D = (Graphics2D)screen;
    
    screen2D.drawString("Example string", x, y)
    }
    Btw thats an awesome avatar haha

  • #3
    Regular Coder Rappa's Avatar
    Join Date
    Nov 2005
    Location
    LI
    Posts
    356
    Thanks
    21
    Thanked 9 Times in 9 Posts
    Thanks for the advice. And yeah I hate IE with a passion lol.


  •  

    Posting Permissions

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