This week's book / license giveaways are in the JDBC and Relational Databases and Java in General forums.
We're giving away four copies each of PostGIS in Action and Java Advanced Topics Training and have the authors on-line!
See this thread and this one for details.
The moose likes Swing / AWT / SWT and the fly likes calling .TIF image in Swing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "calling .TIF image in Swing" Watch "calling .TIF image in Swing" New topic

calling .TIF image in Swing

Nagaseshagiri poola

Joined: Oct 18, 2003
Posts: 25
i am calling the .TIF format picture in the swing application and it is not showing any error and not displaying the image i requested.
my code looks like this
JLabel img = new JLabel("", new ImageIcon("index.TIF"), JLabel.CENTER)
but the image is not displayed and i tried with .gif and .jpeg and its working fine.
can somebody help me
thank you
Nathan Pruett

Joined: Oct 18, 2000
Posts: 4121

The JRE only provides support for GIF, JPEG, and PNG images. For any other image types, you'll have to use JAI (Java Advanced Imaging API) or a third party class for TIFF decoding.

Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Brian Pipa
Ranch Hand

Joined: Sep 29, 2003
Posts: 299
I beleive you can only use gif/jpg, or png images. Take a look at the Javadocs for Toolkit.getImage()

My Java Freeware:<br />MACCC - <a href="" target="_blank" rel="nofollow"></a><br />Nator - <a href="" target="_blank" rel="nofollow"></a>
jQuery in Action, 2nd edition
subject: calling .TIF image in Swing