• 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

Loading Multiple Images to a JPanel

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi there folks

I want to have 15 images displayed on a JPanel probably in a 5x3 formation on a JPanel. These images are just little drawings that have been done in Paint and are saved as jpg's.

I created an Image class that was to contain features common to all images ie. all images would have a width (150 pixels), height (120 pixels), x position and a y position. I would then use this class in the JPanel class to show each of the 15 images onto the JPanel. Is this a good way of doing it and if so can someone show me how I get the images up. Or is there a better way of doing this?

I have posted my Image class code below for you to look at - many thanks to anyone in advance that can help me out.

 
Ranch Hand
Posts: 1282
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You have a start, ..... There are a lot of tools in javax.swing.JStuff..

Take a look at Layout Managers without looking at it, that may be overly complicated but work on it awhile and then show up in Swing / AWT / SWT / JFace with whatever questions you have.

What you have is useful, keep it and build on it.
 
You ridiculous clown, did you think you could get away with it? This is my favorite tiny ad!
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic