jQuery in Action, 3rd edition
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

Win a copy of OCA Java SE 8 Programmer I Study Guide this week in the OCAJP 8 forum!
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="http://maccc.pipasoft.com" target="_blank" rel="nofollow">http://maccc.pipasoft.com</a><br />Nator - <a href="http://nator.pipasoft.com" target="_blank" rel="nofollow">http://nator.pipasoft.com</a>
I agree. Here's the link: http://aspose.com/file-tools
subject: calling .TIF image in Swing
It's not a secret anymore!