• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Showing a GIF file in a layout

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi i am currently trying to display a GIF file on a gridLayout. Which is the best way to do this, the drawImage() function? any help would be greatful!
 
Ranch Hand
Posts: 4632
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
add a JLabel to the gridlayout, using the .gif file as the label's icon
 
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Matt

add a JLabel to the gridlayout, using the .gif or .jpg file as the label's icon

Eg:
-----------------------
jLabel1 = new JLabel();
jLabel1.setIcon(new ImageIcon("C:\\images\\image001.jpg"));

contentPane = (JPanel)this.getContentPane();
contentPane.setLayout(new GridLayout(1, 0, 0, 0));
contentPane.add(jLabel1, 0);
reply
    Bookmark Topic Watch Topic
  • New Topic