display bmp images using JLabel

  • Thread starter SJ L via JavaKB.com
  • Start date
S

SJ L via JavaKB.com

Hello, I am trying to write a viewer that is able to read/display bmp, jpg,
gif and png files. Currently, my program is unable to read bmp files! Help!

ImageIcon ii = new ImageIcon(str);
CustomScrollPane sp = new CustomScrollPane(new JLabel(ii));

where did i go wrong... using the above code i am able to read jpg, gif and
png!
 
A

Andrew Thompson

SJ said:
Hello, I am trying to write a viewer that is able to read/display bmp, jpg,
gif and png files. Currently, my program is unable to read bmp files!

PNG, JPEG and GIF are supported. BMP is not. To read
Windows (and other more specialist) formats, you will
need to turn to something like JAI.

Of course, if you control the BMP's, you might convert
them to one of the three formats that the core classes
understand.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,763
Messages
2,569,563
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top