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 The Software Craftsman this week in the Agile forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "Adding Gif to Gui" Watch "Adding Gif to Gui" New topic

Adding Gif to Gui

Heather Marie

Joined: Sep 25, 2005
Posts: 8

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!

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

Joined: Sep 25, 2005
Posts: 8
Have you tried LearnNowOnline?
subject: Adding Gif to Gui