Win a copy of Terraform in Action this week in the Cloud forum!
  • 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 ...
  • Tim Cooke
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Rob Spoor
  • Bear Bibeault
Saloon Keepers:
  • Jesse Silverman
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Al Hobbs
  • salvin francis

Loading Multiple Images to a JPanel

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 showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
    Bookmark Topic Watch Topic
  • New Topic