Question: Write a JavaFX Application that allows the user to draw (scribble) on the scene by dragging the mouse. In the upper-left corner, provide a button

Write a JavaFX Application that allows the user to draw (scribble) on the scene by dragging the mouse. In the upper-left corner, provide a button to clear the scene and a color picker to choose the current drawing color. The button should be labeled "Clear scene". Hint: Use the standard JavaFX ColorPicker. (Or if you already wrote one earlier, you could use your own version). Hint: Add a new Polyline to the scene each time the mouse button is pressed down. As the mouse is dragged, add points to current Polyline, and draw the current Polyline using the color the user chose in the ColorPicker. This way, the user can draw a bunch of lines with different colors. Hint: To store all those Polylines the user is making, create an array of Polylines as an instance variable of the Application you are creating. Make the array big enough (say size 100) so that it would accommodate most any user's needs. Hint: When the user hits the "Clear scene" button, iterate through all the Polylines in the array, remove each from the Scene and store a null value in the array.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!