Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Below is class called house. I need help making a new class house2 that in a 2x2 gridlayout and extend Jframe. In house2 class, I

Below is class called house. I need help making a new class house2 that in a 2x2 gridlayout and extend Jframe. In house2 class, I need a loop that make an instance of the house class in each row and column in grid. The loop need to be in house2 class.

house class:

import java.awt.*; import javax.swing.JFrame; import javax.swing.JPanel;

class house extends JPanel { private Color rectangle; private Color triangle;

public house(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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatial Database Systems Design Implementation And Project Management

Authors: Albert K.W. Yeung, G. Brent Hall

1st Edition

1402053932, 978-1402053931

More Books

Students also viewed these Databases questions