well you need to use an Applet/JApplet:
Code:
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
public class Hello extends JApplet
{
public void init()
{
Container c = getContentPane();
c.setBackground(Color.blue);
repaint();
}
public void paint(Graphics g)
{
super.paint(g);
g.setColor(Color.white);
g.drawString("Hello World!", 50, 50);
}
}
Now you just need to make an html file to run it when its compiled:
Code:
<html>
<body>
<applet code="myprogramname.class" height=100 width=100></applet>
</body>
</html>
__________________