Programming Assignment 5 2D Drawing Applicationlanguage javaJav.docx

  • Adrian College
  • CIS 123
  • Homework Help
  • billheolm564
  • 7
  • 75% (8) 6 out of 8 people found this document helpful

This preview shows page 1 - 4 out of 7 pages.

Programming Assignment 5 2D Drawing Application language: java Java 2D Drawing Application. The application will contain the following elements: a) an Undo button to undo the last shape drawn. b) a Clear button to clear all shapes from the drawing. c) a combo box for selecting the shape to draw, a line, oval, or rectangle. d) a checkbox which specifies if the shape should be filled or unfilled. e) a checkbox to specify whether to paint using a gradient. f) two JButtons that each show a JColorChooser dialog to allow the user to choose the first and second color in the gradient. g) a text field for entering the Stroke width. h) a text field for entering the Stroke dash length. I) a checkbox for specifying whether to draw a dashed or solid line. j) a JPanel on which the shapes are drawn. k) a status bar JLabel at the bottom of the frame that displays the current location of the mouse on the draw panel. If the user selects to draw with a gradient, set the Paint on the shape to be a gradient of the two colors chosen by the user. If the user does not chose to draw with a gradient, then Paint with a solid color of the 1st Color. The following code can create a gradient paint object:
Paint paint = new GradientPaint(0, 0, color1, 50, 50, color2, true); To set the stroke for a line to be drawn, you can use the following code: if (dashCheckBox.isSelected()) ����������� { ����������� stroke = new ��������������� BasicStroke(lineWidth, BasicStroke.CAP_ROUND, BasicStroke.JOIN_ROUND, 10, dashLength, 0); } else ����������� {

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture