Tyler Pennington
1
Problem Description
In this homework you are going to use JavaFX to create a paint tool similar to Microsoft Paint. This assignment will test your understanding and ability to use lambda expressions and event-driven programming.
You will be provided one file, Tool.java. Tool is an interface that represents a general tool used for drawing on the canvas, such as a Pencil tool or Rectangle tool. Tool has three abstract methods: onPress, onDrag, and onRelease. These methods represent actions that should occur when the mouse button is pressed down, dragged while still pressed down, and then released. You will implement this interface to create different tools for your paint program. 2
Requirements
This assignment is meant to be open-ended. The implementation and design is up to you to decide. The quality of your design will be graded in accordance with the concepts you have learned in this class.
At the very minimum, your submission should include the following:
1. A file named PaintFX.java which starts up your JavaFX application.
2. A canvas that you can draw on using various tools, and a way to clear everything on the canvas.
3. A way to change the current color.
4. You will also need to implement the following tools:
(a) A Pencil tool to draw simple lines on the canvas.
(b) A Rectangle tool to draw solid rectangles.
(c) One (or more) tools of your choosing. This can be another kind of shape, an eraser, a paintbrush, or anything else that could be considered useful. Try to have fun with this one, but please don’t submit something trivial or something that you wouldn’t normally see in a paint program. Feel free to add as much functionality as you want as long as the base requirements are fufilled.
3
Solution and Tips
To help you with this assignment, here are some suggested readings and links to useful classes in the JavaFX API.
1. JavaFX Layouts
2. Helpful JavaFX Classes: Canvas, GraphicsContext, ColorPicker, Color
3. Re-read