View Full Version : Web Question

02-25-2008, 04:44 AM
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.

02-27-2008, 04:08 AM
The HTML for putting a java applet on a webpage is:

<applet code="applet file here.class" widh="width" height="height"></applet>

The structure of a java applet is:

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

02-27-2008, 06:40 PM
Thanks for the advice. And yeah I hate IE with a passion lol.