Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Applet and HTML

Status
Not open for further replies.

blackbirdMIT

IS-IT--Management
Aug 28, 2003
22
0
0
US
I have these files:

AnotherHello.class
AnotherHello.html
AnotherHello.java


Applet Code:
import java.applet.Applet;
import java.awt.*;

public class AnotherHello extends Applet
{
public void paint ( Graphics gr )
{
setBackground( Color.lightGray );
gr.drawString("Hello", (300/2 - 40/2), (150/2 + 10/2) );
}
}


HTML Code:

<html>
<body>
<applet code=&quot;AnotherHello.class&quot; width=&quot;300&quot; height=&quot;150&quot;>
</applet>
</body>
</html>

I did this:
C:\> appletviewer AnotherHello.html

BUT, it still didn't show me the applet with the Hello string. System would hung when using the appletviewer.

I also tried to open the html file using the internet explorer browser. All I get is the gray box but without the Hello String.

WHAT AM I MISSING?
 
I copied and pasted your code, compiled it, ran it, and everything worked fine in appletviewer as well as IE. Your problem is somewhere else besides in your code.

tbuch
 
I tried another computer and it worked for me too.

My new problem is ...

I tried Microsoft Frontpage to start a nice html then inserted my applet in it. When I view my html, I only see my html and an empty gray box that's suppose to be my applet. I don't have any problem now viewing my applet using 'appletviewer'. But I still can't view my applet in my html file using my internet explorer 6.0

WHY?
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top