This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes problem with arrays and paint Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "problem with arrays and paint" Watch "problem with arrays and paint" New topic

problem with arrays and paint

ed jones

Joined: Oct 01, 2008
Posts: 11
I would like to make 5 rows each with 10 blocks of Rectangles

When I run this I only see the last row, and I can't figure out why?

Also is there a better way to approach this ? / ie: creating Rectangle objects.

thanks for your time
Campbell Ritchie

Joined: Oct 13, 2005
Posts: 37891
Your problem is with the for loops; read carefully what you are entering into the array and what you are retrieving.
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
subject: problem with arrays and paint
Similar Threads
Applet not running
Array of colors in paintComponent method.
Thread.sleep question
How to make rectangle drawn to be vissible when a new rectangle is drawn
Array overwritten