Question: Can somone help me make a class called myhouse2 . The myhouse2 class is split in 2x2 grid and has a loop that make an
Can somone help me make a class called myhouse2. The myhouse2 class is split in 2x2 grid and has a loop that make an intsance of the myhouse class in each row and column in the 2x2 grid.
myhouse class:
import java.awt.*; import javax.swing.JFrame; import javax.swing.JPanel;
class myhouse extends JPanel { private Color rectangle; private Color triangle;
public myhouse(Color rect, Color tri) { rectangle = rect; triangle = tri; } public void paintComponent(Graphics g) { super.paintComponent(g); g.setColor(rectangle); g.drawRect(50, 100, 200, 100); g.setColor(triangle); g.drawPolygon(new int[] {50, 150, 250}, new int[] {100, 20, 100}, 3); }
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
