0

I have just learned to use arraylist so be nice :P .

I wonder how i can put a few objects (like a circle or a square) into the arraylist and draw them out on a jpanel so all of them stay. I know how to draw one thing but i'm trying to make a game and would like to have multiple things drawn at the same time.

All answers appreciated!

yossico
  • 3,421
  • 5
  • 41
  • 76
user3611818
  • 247
  • 2
  • 3
  • 13

1 Answers1

2

I dont femiliar with JPanel and swing but a bsic algorithm will be:

  1. add all the wanted objects to arraylist (or an other data stracture)
  2. Start Loop
  3. for every item on the data stracture - item.Draw
  4. update all locations
  5. return to loop start
yossico
  • 3,421
  • 5
  • 41
  • 76