This week's book giveaway is in the OO, Patterns, UML and Refactoring forum. We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line! See this thread for details.
This is a 2 part project that involves me first making a rectangle and then using it to make a 4x4 grid to display different types of color. The problem is that I have never made or been shown how to make a grid.
here is the project to help clarify:
"Box.java should have these instance variables (all of type int): upperLeftX, upperLeftY, height, width, and one more instance variable of type Color named boxColor. Make them all private and provide Getters and Setters for each instance variable. Tip: Eclipse will build getters and setters for you. Go to the Menu bar in Eclipse and select Source -> Generate Getters and Setters.
Provide the body of the following Constructor that sets the values of the instance variables:
public Box(int upperX, int upperY, int h, int w, Color myColor)
Create a method called display(Graphics g) that uses setColor(boxColor); and fillRect(upperLeftX,upplerLeftY,width, height); to fill our box.
Also in the java1_BoxProject, Make a Javaapplet named Grid.java. This applet should display a 4 x 4 grid of boxes, each with a different color (there are 13 standard colors you can look up in the Color Class in the API, you can use a few twice to get 16 boxes).
You must create 16 instances of the Box class and display them. Do not reuse just one box object".