I use the getResource(String) method in ClassLoader
to obtain URLs which I then use to load my textures
(or for any other reason).
I use code along the lines of
URL u = this.getClass().getClassLoader().getResource("/fred.jpg");
Where the 'this' has been loaded from the same JAR as that which contains
the jpeg. The leading '/' on the path name of the jpeg within the JAR is important.
Rob
Carl Smotricz wrote:
> Hello Joerg,
>
> At 18:11 08.08.00 +0200, you wrote:
> > >
> > > > 4.) How can I load an image from a jar?
> > >
> >Nothing there on loading images from jars. It has to be something around
> >ClassLoader.getResource()...
>
> nah... I've never tried this, but I would use java.util.JarInputStream
> to read the contents of the Jar or, better yet, just the uncompressed
> image (GIF or JPEG) file into an array of bytes, and then
> Toolkit.getDefaultToolkit().createImage() to make an Image from
> that.
>
> >Sure, double or triple buffering is very common. BUT, just doublebuffering a
> >800x600 canvas, which implies one 800x600 drawImage(), crashes my
> >performance down to 20fps. Hey, Sun, did you ever hear of blitting
> >hardware??
>
> I read a recent answer from a Sun person (Kelvin Chung, I think) who
> said that, with the right circumstances, Java 3D *does* blitting.
> Unfortunately,
> I don't remember what the circumstances were; maybe he'll come back and
> shed some light?
>
> >Sigh, Java is REALLY difficult....
>
> Just the right challenge for an outfit that calls itself 'hard code', no?
> *grin*
>
> >- J
> >
> >Joerg 'Herkules' Plewe
> >HARDCODE Development
> >http://www.hardcode.de
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST". For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
--
Rob Nugent
Development Manager
PeerLogic
[EMAIL PROTECTED]
http://www.peerlogic.com
Tel: +44 (0) 1489 585503
Fax: +44 (0) 1489 881363
===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST". For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".