aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes Adding Gif to Gui Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Adding Gif to Gui" Watch "Adding Gif to Gui" New topic
Author

Adding Gif to Gui

Heather Marie
Greenhorn

Joined: Sep 25, 2005
Posts: 8
Hi!

Can anybody give me some simple code from Swing to add a gif file (stored on c drive) to an application for an assignment I'm working on. I thought this would be the easiest part of the whole assignment but for some reason I can't get it. I'm not sure what to use....ImageIcon? Please help! Desperate student!

Heather
Michael Dunn
Ranch Hand

Joined: Jun 09, 2003
Posts: 4632
add the gif file as the icon for a JLabel
add the JLabel to a JPanel
add the panel to the JFrame/contentPane

something like this

Heather Marie
Greenhorn

Joined: Sep 25, 2005
Posts: 8
Thanks!!!
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Adding Gif to Gui