Hi,
I have been through other posts regarding this problem. But their
solutions don't fix my problem.
I have tried different variations, but the basic is :
ImageIcon lIcon = new ImageIcon("pic.bmp");
JLabel jl = new JLabel(lIcon);
addComponent(dpanel, jl, 0 ,0, 100, 100);
But nothing shows up. I also tried :
java.net.URL thePic = this.getClass().getResource("pic.bmp");
System.out.println("Pic URL is: " + thePic);
String dir = System.getProperty("user.dir");
System.out.println("user dir : " + dir);
ImageIcon lIcon = new ImageIcon(thePic);
if(leafIcon.getImageLoadStatus() == MediaTracker.COMPLETE) {
JLabel jl = new JLabel(lIcon);
addComponent(dpanel, jl, 0 ,0, 100, 100);
}
Also doesn't work.
Any help greatly appreciated!!
Thanks,
Gil
Andrew Thompson - 22 Jun 2005 15:51 GMT
(loading image..)
> I have tried different variations, but the basic is :
>
[quoted text clipped - 3 lines]
>
> But nothing shows up.
I suggest
- (for the moment) you stick to *one* version.
- Show a *complete* example that shows what you are attempting to do.
<http://www.physci.org/codes/sscce.jsp>
..and..
>..I also tried :
..
> Also doesn't work.
Be a lot more explicit about what "doesn't work" and *why*.
<http://www.physci.org/codes/javafaq.jsp#exact>
All I can determine from "doesn't work" is "might be lazy". [ ;-) ]

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
brightoceanlight@hotmail.com - 23 Jun 2005 08:27 GMT
Thank you everyone for the posts!
I don't know why I would have ever thought .bmp files would be
supported in Java. I plead temporary insanity.
Choosy mothers prefer Gif.
Thanks,
Gil
Andrew Thompson - 23 Jun 2005 08:54 GMT
> I don't know why I would have ever thought .bmp files would be
> supported in Java.
Ehh.. Yeh - I missed that bit.
Fortunately Thomas noticed it.
>..I plead temporary insanity.
;-)
> Choosy mothers prefer Gif.
Actually, ..there *was* an entire movement of people who
hated(d) GIF's as well. The patent was owned by ..compuserve(?)
and the legal hassles of using GIF's had folks making comments
such as 'burn all GIFs'.
The patent on GIF's ran out recently, so I am not sure what
the current position is.
[ Personally, I prefer .PNG. ;-) ]

Signature
Andrew Thompson
http://www.PhySci.org/codes/ Web & IT Help
http://www.PhySci.org/ Open-source software suite
http://www.1point1C.org/ Science & Technology
http://www.LensEscapes.com/ Images that escape the mundane
Thomas Fritsch - 22 Jun 2005 19:39 GMT
brightoceanlight@hotmail.com schrieb:
> Hi,
Hi !
> I have been through other posts regarding this problem. But their
> solutions don't fix my problem.
>
> I have tried different variations, but the basic is :
>
> ImageIcon lIcon = new ImageIcon("pic.bmp");
Are you sure, that your Java supports decoding BMP images?
I am pretty sure that Sun's Java supports GIF, JPEG, PNG (and maybe
more), but not BMP. Therefore I suggest, you try with a GIF image first,
to see if that doesn't work, too.
> JLabel jl = new JLabel(lIcon);
> addComponent(dpanel, jl, 0 ,0, 100, 100);
[quoted text clipped - 18 lines]
>
> Gil

Signature
"Thomas:Fritsch$ops:de".replace(':','.').replace('$','@')