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:

Rectanglesviewer Number of Rectangles: Draw OX
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
