Question
package labBuilding; import java.awt.Graphics; import javax.swing.JPanel; @SuppressWarnings(serial) public class Building extends JPanel { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // TODO: write code to
package labBuilding;
import java.awt.Graphics;
import javax.swing.JPanel;
@SuppressWarnings("serial") public class Building extends JPanel { @Override protected void paintComponent(Graphics g) { super.paintComponent(g); // TODO: write code to draw the building }
}
package labBuilding;
import javax.swing.JFrame;
@SuppressWarnings("serial") public class BuildingApp extends JFrame {
public static void main(String[] args) { new BuildingApp().run(); } public void run() { setBounds(100, 10, 400, 500); setDefaultCloseOperation(EXIT_ON_CLOSE); add(new Building()); setVisible(true); }
}
Lab Building CSIS-1410 Learning Outcome: Formulating Algorithms Review Review for loops Review random numbens Practice drawing Getting Started: Download labBuilding.zip from Canvas and unzip it. Import the extracted ( unzipped ) code files into Eclipse: Right-click the src folder that should include the new package mport., the Import dialog opens Select General> File System and click Next the Import from directory dialog opens -Use the Browse button to navigate to the folder labBuilding and click OK Select the checkbox next to the folder labBuilding IMPORTANT: Select the checkbox next to Create to-level folder Click Finish Run the application to make sure that the file import worked as expected. Description: Implement the overridden method paintComponent so that it paints a tall building with multiple rows of windows Requirements: 1. Use for loops to draw the windows 2. Use random colors (every time the building is repainted some of the colors change randomly. Which of the areas change is up to you
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started