Answered step by step
Verified Expert Solution
Question
1 Approved Answer
help about java application the original code is i need to add at least 4 buttons centered along the top of the window that will
help about java application the original code is i need to add at least 4 buttons centered along the top of the window that will allow a user to change the colour of the lines (e.g., red, blue, green, purple) and the output like
import javafx.application.Application; import javax.scene. Scene: import javafx.scene. Group; import javafx.scene.paint.Color; import javafx.scene. shape.*; import javafx.stage.Stage; import javafx.scene.input.MouseEvent; public class ElasticLines extends Applicationf private Line line; private Group root: Override public void start (Stage primaryStage)f root = new Group(); scene scene new scene (root, 500, 500,Color.LIGHTBLUE); scene.setonMousePressed (this::processMousePress): scene.setonMouseDragged (this:processMouseDrag) primaryStage.setTitle ("Elastic Lines"); primaryStage.setscene (scene) primaryStage. show ) public void processMousePress (MouseEvent e)f e . getX ( ) , e . getY ( ) ) ; line-new Line (e. getX ( ) , e . getY ( ) , line.setStroke (Color.RED) line.setStrokeWidth (3) root.getChildren () .add (1ine) public void processMouseDrag (MouseEvent e) line.setEndx (e.getX )) line.setEndY (e.getY)) public static void main (String[] args) i Application.launch (args)Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started