• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Regarding Applet Download

 
vikram sawant
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
i have a question regarding the Downloads of the Applet . The jar size of the applet is around 38 kb and along with this i have to download 20 images hence because of this applet takes along time to download . Can anyone suggest me some way so that i can reduce the download time .Well there would be some way thru which i can download all the images in one single connection

 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Put the images in the jar! That was one of the original reasons that Sun created JAR format.
 
vikram sawant
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
Thanks for taking out time , Ok but can u put fwd me the code how u are going to access the images thru the jar Foramat because while creating the Image object we have to specify the path where the files are stored . wat about that? Can u exactly how r u going to download the image file by keeping them in the Jar Format with an example (i mean by writing a code )
 
Tim Holloway
Saloon Keeper
Posts: 18367
56
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The getCodeBase() method is used to get the handle that allows you to reference the downloaded image. This is pretty basic stuff that can be found in most into Java books. I use the O'Reilly "Java Examples in a Nutshell".
[This message has been edited by Tim Holloway (edited August 03, 2001).]
 
vikram sawant
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi ,
it seems u didntget my question while downloading the image the following procedure is normally employed
Image img = getImage(getCodeBase(),"image/name.gif" )
MediaTracker md = new MediaTracker(this);
md.add(img,1);
try
{
md.waitFor(1) ;
}
catch (Exception e)
{
}
so now the Question is if i am putting it in the Jar format wat will be my code and how am i going to refer to the image file name .gif in the getImage method
 
Nathan Pruett
Bartender
Posts: 4121
IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I found your answer on Sun's website... here's the link if you want to read it yourself... http://developer.java.sun.com/developer/qow/archive/76/index.html

Basically, all you have to do is this...



Where MyClass is the name of the class this code is in, and "abc.gif" is the filename of your image... Then you can put this image through the MediaTracker!

HTH,
-Nate
[This message has been edited by Nathan Pruett (edited August 03, 2001).]
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic