Question: I am new to using Eclipse and Java and need some help with a homework assignment. I am using Java 11. I did the first
I am new to using Eclipse and Java and need some help with a homework assignment. I am using Java 11. I did the first part but the second part is where I am totally lost. Any help would be greatly appreciated. I have added the UMP diagram and the grid class implementation below.

Grid Class Implemn
package portrait;
import java.awt.Color; import java.awt.Graphics2D;
/** * * @author tompkinsj * */ public class Grid {
private int w; private int h; private int x; private int y; private boolean showGrid = false;
public Grid(int x, int y, int w, int h) { this.x = x; this.y = y; this.w = w; this.h = h;
}
public void display(Graphics2D g2) {
for (int x1 = x; x1 0) { g2.setColor(Color.lightGray); g2.drawString("" + x1, x1, 15); } g2.drawLine(x1, 0, x1, h); } for (int y1 = y; y1
}
public void toggleGrid() { showGrid = !showGrid; } public boolean isVisible() { return showGrid; }
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
