Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

Loading Multiple Images to a JPanel

 
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • 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
  • 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.
    Bookmark Topic Watch Topic
  • New Topic