Posted: Sat Jan 14, 2006 5:12 pm Post subject: Displaying Images using Swing
Hello, I have been wracking my brain on how to get pictures to display in an application(Game). I've read various articles including some on this site but all I find is useless fragments of code and no explanations behind them(ImageObserver?MediaTracker?etc etc)or totally depricated commands. So I am hoping someone could shed some light on displaying images in an applicaion(not applet, unless you recommend it).
Sponsor Sponsor
evogre3n
Posted: Mon Jan 16, 2006 7:53 am Post subject: (No subject)
code:
ImageIcon image = new ImageIcon ("imagepath.gif");
JLabel label = new JLabel (image);
frame.getContentPane ().add (label);
Where frame is your window, you may choose to add the JLabel to a panel and then add the panel to the frame