This week's giveaway is in the EJB and other Java EE Technologies forum. We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line! See this thread for details.
I am working on a school project where I need to draw a wall of bricks with drawRect based on user input. This input asks for how many rows they would like to see. There can be up to 20 rows of bricks. Every odd row needs to be indented a half size. I am OK with the input part. I am currently working on drawing the rows. They way I am doing this works, but there must be an easier way. It is very repetitive.. Here is my code. (numRows is the value they enter). Thanks!
There's a number of ways of simplifying this. You could start by getting rid of the duplicated lines of code. If instead of "== 1", "== 2", etc, you wrote ">= 1", ">= 2" etc., what would the code look like?
Ping & DNS - updated with new look and Ping home screen widget