• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JApplet resources

 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi

I made a simple applet in NetBeans which can display 8 JPG images. It uses a CardLayout. I can see the JPG images when I test it in NetBeans, but when I uploaded everything and tested it with FireFox, I see a light gray panel where the first image should be. I see the JLabel in the south region and when I click on each panel the label cycles through each file name but there is never an image. My applet file resides in the default package and I have the JAR and CLASS files in the same place on my web space along with the JPG files. The JApplet loads on the webpage without any errors.
 
Norm Radder
Bartender
Posts: 1240
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you are loading and running the applet using a server, then the applet must use URLs to get to the image files on the server. How are you loading the images in the applet? You would use getCodeBase() to get the URL of where the applet loaded from and append to that the path to the image file.
If the images are in the jar file, use getResourceAsStream()
[ August 07, 2008: Message edited by: Norm Radder ]
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok Norm, I'll give it a try.
 
Isaac Hewitt
Ranch Hand
Posts: 191
Netbeans IDE
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
stupid absent mindedness. it's been so long since I did an applet.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic