Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a graphical program that provides a GUI that enables the user to control various aspects of drawing from a JComboBox as well as from

Write a graphical program that provides a GUI that enables the user to control various aspects of drawing from a JComboBox as well as from a menu item and dimensions in method paintComponent.

The title bar will display "Drawing Shapes and Displaying all Info"

This program uses methods from class MouseAdapter and MouseMotionAdapter, which allows the user to press the mouse button, drag the mouse and release the mouse button. When the mouse is released, draw a shape with the appropriate upper-left corner, width and height. [Hint: The mousePressed method should capture the set of coordinates at which the user presses and holds the mouse button initially, and the mouseReleased method should capture the set of coordinates at which the user releases the mouse button. Both methods should store the appropriate coordinate values. All Calculations of the width, height and upper-left corner should be performed by the paintComponent method before the shape is drawn.

This program also allows the user to

Select which shape to draw from a comb box. A JComboBox class should provide options including at least circle, rectangle, square, etc... The first item (Circle) in the JcomboBox should be the default shape with black color and not solid shape that is displayed the first time paintComponent is called.

Specify whether a shape should be filled or empty when it is drawn. The user should click a JCheckBox to indicate filled or empty. (Also the graphic will be displayed to fill or empty after you click the checkbox.)

Select the drawing color from JColorChooser dialog box when the user clicks on Pick Color button.

If the user changes the drawing options from the drop-down list, the graphic will automatically upgrade to the appropriate shape in the drawing panel. (Setup the background color of drawing panel to Light-Gray color.)

e. Also display the information about that shapes info, circumference and area in a read-only JTextArea

f.Default: set the font size on the JTextArea to 20 points, Serif and Font.PLAIN. Also set the default text color to black and background color to white. You can change the text color, font and background color from (Text) menu.

figures. 1. Allow the user to select Black, Blue, Red, and Green color for the text color

from a IRadioButtonMenuItem (Color). Need to use ButtonGroup to group together.

Also set the default text color to black and background color to white

Allow the user to select Serif, Sans-serif or Monospaced from a submenu (Font). Provide a Bold JCheckBoxMenuItem and an Italic JCheckBoxMenuItem, which, if checked, makes the text bold, italic or both.

Allow the user to change the text areas background color from Background submenu.

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

More Books

Students also viewed these Databases questions