Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Image or ImageIcon?  RSS feed

 
Gad Flailimbs
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm curious as the best Image object to use when you're tossing about 100+ images onto a JPanel at a time. I believe ImageIcon extends Image but is it pointless to use it on such a large scale?

Thanks for the info!
 
Craig Wood
Ranch Hand
Posts: 1535
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
tossing about 100+ images onto a JPanel at a time. I believe ImageIcon extends Image but is it pointless to use it on such a large scale
According to the ImageIcon class api ImageIcon extends Object and implements the Icon interface (among others). It allows "easy" loading, can draw itself, can hold a descriptive String and is used in Swing components such as JLabel and extensions of AbstractButton. If you don't need some of these things you could use an array of BufferedImage or, if you don't mind dealing with Generics, an ArrayList.
 
Gad Flailimbs
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the info. I was more curious for anyone who has had personal experience with an alternative on a similar scale.

With what you've just said it seems ImageIcon is probably best choice for animated character images and other stuff I'm looking at. Thanks again.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!