Programming C, C++, Java, PHP, Ruby, Turing, VB
Computer Science Canada 
Programming C, C++, Java, PHP, Ruby, Turing, VB  

Username:   Password: 
 RegisterRegister   
 Displaying Images using Swing
Index -> Programming, Java -> Java Help
View previous topic Printable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic
Author Message
Nitrix




PostPosted: 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
Sponsor
sponsor
evogre3n




PostPosted: 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

This is one of many ways...
Display posts from previous:   
   Index -> Programming, Java -> Java Help
View previous topic Tell A FriendPrintable versionDownload TopicSubscribe to this topicPrivate MessagesRefresh page View next topic

Page 1 of 1  [ 2 Posts ]
Jump to:   


Style:  
Search: