Re: How to load images
Ottavio Campana wrote:
Maybe this isn't the most correct place where I should post this message
but I haven't find any answer in any other place....
you could try searching or posting to:
I've writing a programm in java with a grafical interface. I've extended
the class Frame and now I need to show some pictures in order to get
something similar to a puzzle. My problem is that I've found some
examples but they all use the method getImage of class Applet. What
should I do to show the images with a frame?
there is an ImageIcon class in javax.swing that will do what you need.
it has various constructors, including one (String name) constructor,
that will let you do this:
once you have an ImageIcon, you can add it like any other JComponent.
i believe it is very limited in what file types it supports; i know it
does support gif and it doesn't support jpeg from my experience.
i know of no correspondingly easy way to do this in AWT, though.
|_ |_ | _ _ |_ "Gravity cannot be held responsible
|_) . |_)|(_|(_ |\ for people falling in love." -- Einstein