Answered step by step
Verified Expert Solution
Link Copied!

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 image text in transcribed 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 likeimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Databases Organizing Information Digital And Information Literacy

Authors: Greg Roza

1st Edition

1448805929, 978-1448805921

More Books

Students also viewed these Databases questions