Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Applet

 
Divya Venkatesh
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When i try to run my program as an Applet the Applet gives me "Security Exception" for any image and Image icons in my program and does not load at all.
Is there anyway by which I can set the path to the directory where my Images are Stored.
Here is the Applet code I am using.
<html>
<title> GAME ! </title>
<head>
<body bgcolor="gray" text="white" >
<center>
<APPLET CODE="game1.class" WIDTH=600 HEIGHT=600>
</APPLET><br>
</center>
</body>
</head>
Is there any modification I have to do to this Code.
Please let me know
Thanks a lot
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Divya
u can make a JAR file having your applet class and images and then use ARCHIVE attribute of the Applet HTML Tag in this way...
<applet code='yourapplet.class' archive='yourjarfile.jar'....>
u can go to following URL for help about the Image in the applet if thats what u want...
SUN Tutorial
regards
maulin
 
Maulin Vasavada
Ranch Hand
Posts: 1873
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
btw,
how r u using images in ur applet?
also look at the Applet API as it says that getImage() of Applet returns immediately even if the image is not loaded yet...
regards
maulin
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic