• Post Reply Bookmark Topic Watch Topic
  • New Topic

JPanel adding multiple images  RSS feed

 
Jonny Carterson
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Below is my code. What I am trying to do is add 5 images from my folder "fileOfImages" to the JLabel and then add the JLable to the panel called "panelADDING".

Each file is called something: 1.jpg, 2.jpg, 3.jpg, 4.jpg and 5.jpg.

How would I modify the look to add each image? My reaction was to think that I could put a (1+i) in front of the .jpg, but that will just not work. Any tips or help?

Thanks.



 
K. Tsang
Bartender
Posts: 3648
16
Firefox Browser Java Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you got the 1+i concept. Now is how would you put this inside your ImageIcon as filename. Think string concat.

Another easier loop is start at i=1 rather than i=0
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!