• Post Reply Bookmark Topic Watch Topic
  • New Topic

Send images to applet (Urgent - Due Friday)  RSS feed

 
jerry_271
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet which uses images to be displayed over the internet (a chess game really the images are the pawns and so on).
The problem is that for some reason i have to give the exact path to the image.
for example
------------
if the class file and the image is on the same directory i can't enter the directory as "picture.gif" I must say "c:\some folder\picture.gif"...(the problem with this is the user will not have the images on his c:\)
I thought i could resolve this problem through using a universal machine(server) and use a java web server to pass the images through "http://machine:8080/picture.gif"...that won't work!
I'm stumped...please help, it's due friday for school
 
sean mclaughlin
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
if the client is downloading the applet in a jar/cab file to view simply put the images in the jar file. to call them simply use the code --
new ImageIcon(YourClassName.class.getResource("YourImage.gif"))
------------------
sean's software tips
 
Matthew Phillips
Ranch Hand
Posts: 2676
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jerry_271,
Please read naming policy and re-register with a name that conforms. We would like you to be able to continue to post here at JavaRanch. Thanks.
Matthew Phillips
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!