Answered step by step
Verified Expert Solution
Question
1 Approved Answer
And this is the basic code Study the 3-page Simple Swing Dialogs companion handout extracted from chapter 3. Review the first 3 pages of the
And this is the basic code
Study the 3-page "Simple Swing Dialogs" companion handout extracted from chapter 3. Review the first 3 pages of the 5-page companion handout "Simple 2D Drawings" extracted from the end of chapter 4 of the textbook. The remaining 1 pages will be needed " for the upcoming Programming Project 1 Given a user specified integer number N, draw a set of (N1) line segments in a JPanel according to the following pattern: Each line segment has its first endpoint positioned at the center of the left side of the Panel while its second endpoint is positioned along the right side of the JPanel such that all these second endpoints are evenly spread along the right side. The second endpoints are spread from the upper right corner to the lower right corner and are vertically apart from each other by height of JPanel divided by N. The JPanel should draw "nicely" when the window is resized. A window is resized when the user clicks on the blue) 3Frame and drags the mouse while pressed and then releases the mouse. Here, "nicely" means that the four lines should remain attached to the edges of the JPanel. Don't forget to put your JPanel in a 3Frame (see figures 4.18 and 4.19 in the "Simple 2D The number N is specified by prompting the user with a Swing Dialog Box using o Add to your Drawpanel class an instance variable named numLines and a o Add to your DrawPanelTest class code that prompts the user to specify N, the JOptionPane. showInputDialog("Enter number of lines between 2 and 100") o Validate that N is a positive integer between 2 and 100. If invalid, keep prompting o From DrawPanelTest construct a DrawPanel instance using your newly added Drawings companion handout). optionPane.showInputDialog (see companion handout "Simple Swing Dialogs). constructor that takes an argument N and initializes numLines by the value of N. number of lines to draw: the user (in a loop) until the user gives a valid response. constructor Submit a zip file into Lab 8 Drop Box that contains: . YourJava source code (do not include "class files) . Screenshot of your Dialog box (see figure below) - Screenshot of the initial window with default square layout - Screenshot of the window resized by stretching it horizontally Screenshot of the window resized by stretching it vertically CIS 254 February 27, 2018 nd 109Step 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