Sign in to follow this  
meeksha

First Java Applet

Recommended Posts

I have uploaded everything to http://www.chooseyourecig.com/javagame/helloworld.html . When I visit this page from my computer (Windows Vista) using both Firefox and Internet Explorer, it works just fine. But when my brother visits on his computer (Windows 7) using the same browsers, it does not work. Also, when my daughter visits from her computer (Windows XP) using both Google Chrome and Internet Explorer, it does not work for her either. What is the most likely cause of this? Thanks in advance for any help you can provide.

Here is the java code
[code]
import java.applet.*;
import java.awt.*;

public class HelloWorld extends Applet
{
private Font a_Font;
Image coolImage;

public void init()
{
a_Font = new Font("Helvetica", Font.BOLD, 48);
setFont(a_Font);
coolImage = getImage(getCodeBase(), "hottie.jpg");
}

public void paint (Graphics g)
{
Color adamBlue = new Color (80,124,224);
g.setColor(adamBlue);
g.drawImage(coolImage,0,0,this);
g.drawString("Hello World!", 50, 75);
}
}
[/code]
Here is the html
[code]
<HTML>
<HEAD>
<TITLE>Hello World Applet</TITLE>
</HEAD>
<BODY>
<CENTER>
<H1>Hello World Applet</H1>
<APPLET CODE="HelloWorld.class" WIDTH=500 HEIGHT=500>
</APPLET>
</BODY>
</HTML>
[/code]

Share this post


Link to post
Share on other sites
You need to install the Java plugin for the browser for Java applets to run. Note that this is not the same as JavaScript.

Java Runtime can be downloaded from the Oracle website. http://www.oracle.com/technetwork/java/index-jsp-141438.html

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this