M
Marteno Rodia
Hello everyone,
I'm building a GUI for an application and I want to display an image
as a part of a JFrame. Which component should I use for this purpose?
I thought I must implement my own component and overload its paint()
method, but I've found ImageIcon. Of course, first I need to read in
an image from a file to an Image object. It is possible to use
BufferedImage class and its read() method... But I must use an
uncompressed image in the PPM format (don't ask why, it's a
requitement). Apparently, the read() method won't recognize this
format. So what should I do?
Unfortunately, I must implement reading the file by myself (it's not a
very complicated task). I think it's perhaps possible to "pull out"
the graphics context for the Image object and then to drow an image
pixel by pixel... But how to do it in detail?
MR
I'm building a GUI for an application and I want to display an image
as a part of a JFrame. Which component should I use for this purpose?
I thought I must implement my own component and overload its paint()
method, but I've found ImageIcon. Of course, first I need to read in
an image from a file to an Image object. It is possible to use
BufferedImage class and its read() method... But I must use an
uncompressed image in the PPM format (don't ask why, it's a
requitement). Apparently, the read() method won't recognize this
format. So what should I do?
Unfortunately, I must implement reading the file by myself (it's not a
very complicated task). I think it's perhaps possible to "pull out"
the graphics context for the Image object and then to drow an image
pixel by pixel... But how to do it in detail?
MR