Question: Help with Java.... I'm just lost, draw, rectangles? Write a program that prompts the user to enter an integer in a text field. When a

Help with Java.... I'm just lost, draw, rectangles?

Write a program that prompts the user to enter an integer in a text field. When a Draw button is clicked, draw as many rectangles at RANDOM POSITION in the component as the user requested

This is the code that i have thus far:

import javax.swing.*;

public class Rectangle1 { public static void main(String[] args) { JFrame frame = new JFrame(); JButton button = new JButton("Click"); JPanel panel = new JPanel(); panel.add(button); frame.add(panel); final int FRAME_WIDTH = 300; final int FRAME_HEIGHT = 400; frame.setSize(FRAME_WIDTH, FRAME_HEIGHT); frame.setTitle("Frame"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); frame.setVisible(true); } }

This is what it's suppose to look like:

 Help with Java.... I'm just lost, draw, rectangles? Write a program

Rectanglesviewer Number of Rectangles: Draw OX

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!