OOP – CSPaint Solved

$ 29.99


Problem Description
In this JavaFX homework, we will be implementing an application similar to MSPaint, but simpler. We call it CSPaint.

Figure 1: One possible design of the application
Solution Description
Your main task is to build a JavaFX application, called CSPaint (this is the name of the class), which meets the following functional requirements:
• There should be three main components to your application: a center canvas where the users will draw, a side pane that will contain the toolbox, and a bottom pane that will contain labels telling the user the X and Y coordinates of the mouse and other useful information.
• The canvas size should be 650 pixels in width and 450 pixels in height.
• The side pane should contain the following:
– Three radio buttons that the user can select from: draw, erase, and circle.
∗ If the user selects draw, they should be able to draw free-form on the canvas. The color should be based on what is entered in the color textbox (described below), and the size of the stroke should be 2 pixels in radius.
∗ When erase is selected, a circle area of radius 10 should be erased around the cursor. The user should be able to click on the canvas and drag the eraser around to erase drawings and shapes.
∗ If the user selects circle and clicks on the application canvas, a circle of radius 15 should be placed at the X and Y coordinates of the mouse. The color should match what the user entered in the color textbox.
• The bottom pane should contain the following:
– Text output that displays the current position of the mouse relative to the drawing pane. Remember that in software developement, the upper left corner is (0, 0), and x coordinate grows as you progress to the right, and y coordinate grows as you progress down.
– Text output that indicates how many shapes have been created on the canvas.

Figure 2: An example of an invalid color
Extra Credit
It is possible to earn a maximum of 20 points of extra credit for additional features that you add to your interface. For example, you might add other shapes to be drawn, a “clear” operation that removes all graphics from the drawing pane, modification of existing shapes, sound effects, etc… We are not placing a set point value per specific type of addition. Instead, we’ll judge the overall product and interface.
JavaFX: Compiling and Running
1. Use this link to download the Java SDK. Be sure it is the SDK and not jmod: here
2. After doing this you will have a new zipped folder on your computer called javafx-sdk-11.0.2. Extract the contents of this zipped folder to the directory holding your hw7 code. Be sure it is in the same folder as your code. There is a way to run JavaFX with the SDK in a different folder but it involves setting environment variables and is much more complex.
3. Compile the file with the JavaFX code (in this case it will be the provided file) by typing into the command prompt (being sure to change fileName.java to the file holding the JavaFX code):
javac –module-path javafx-sdk-11.0.2/lib –add-modules=javafx.controls fileName.java
4. To run the code type in the command prompt(being sure to change fileName to the file holding the JavaFX code):
java –module-path javafx-sdk-11.0.2/lib –add-modules=javafx.controls fileName
[100] CSPaint
• [1] Compiles (failing this is an automatic zero)
• [5] Canvas exists with dimensions 650 x 450
• [19] Side bar – [5] Exists
– [9] Contains 3 radio buttons for draw, erase, and circle (3pts each)
– [5] Contains editable textbox for color
• [25] Bottom var
– [5] Exists
– [10] Contains mouse position that properly updates
– [10] Contains shape count that properly updates
• [50] Functionality
– [10] Able to correctly draw on the canvas
– [10] Able to correctly erase from the canvas
– [10] Able to correctly create circles on the canvas
– [10] Drawing/circles use color from textbox
– [10] Invalid entries in the color textbox result in a pop-up alerting the user
[20] Extra credit
Feature Restrictions
There are a few features and methods in Java that overly simplify the concepts we are trying to teach. For that reason, do not use any of the following in your final submission:
• var (the reserved keyword)
• System.arraycopy
Checkstyle and Javadocs
You must run checkstyle on your submission. The checkstyle cap for this assignment is 20 points. Review the style guide and download the checkstyle jar. Run checkstyle on your code like so:
$ java -jar checkstyle-6.2.2.jar -a *.java Audit done. Errors (potential points off):
Make sure to include the -a flag included for testing both checkstyle and javadocs
The message above means there were no Checkstyle or javadoc errors. If you had any errors, they would show up above this message, and the number at the end would be the points we would take off (limited by the checkstyle cap mentioned above). The Java source files we provide contain no Checkstyle errors. In future homeworks we will be increasing this cap, so get into the habit of fixing these style errors early!
Depending on your editor, you might be able to change some settings to make it easier to write style-compliant code. See the customization tips page for more information.
Collaboration Statement
I worked on the homework assignment alone, using only course materials.
In order to help learn course concepts, I worked on the homework with [give the names of the people you worked with], discussed homework topics and issues with [provide names of people], and/or consulted related material that can be found at [cite any other materials not provided as course materials for CS 1331 that assisted your learning].
For this assignment, you will be submitting any and all files needed for your submission to compile and run properly. For example:
• CSPaint.java
• Any supporting .java files
• Any image/sound files used in your GUI
Submit all files necessary for your program to run. Do not submit .class files; only submit .java files, we DO NOT accept .fxml files. Check Piazza before submitting for important updates and clarifications.
Please make sure you have included all the necessary files for your program to compile and run. If your submission does not compile because you forgot a file, or if it cannot run because an image is missing, we won’t be able to award you any points no matter how small the error. Re-download and double check your submission in a different folder from your original project to make sure it works!
Failure to follow the instructions will result in a heavy point deduction or even 0 on the project.
Important Notes (Don’t Skip)
• Non-compiling files will receive a 0 for all associated rubric items
• Submit every file each time you resubmit
• Read the “Allowed Imports” and “Restricted Features” to avoid losing points
• Check on Piazza for a note containing all official clarifications


There are no reviews yet.

Be the first to review “OOP – CSPaint Solved”

Your email address will not be published. Required fields are marked *