Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1 4 0 1 3 1 0 3 - 4 ADVANCED PROGRAMMING Ex 2 : Event - Driven Programming Lab Objectives: To know how to
ADVANCED PROGRAMMING
Ex: EventDriven Programming
Lab Objectives:
To know how to deal with different types of Events on different UI Controls.
To know how to use Lambda expression to register the handler with the source object.
ADVANCED PROGRAMMING
Ex: EventDriven Programming
Design the previous GUI using JavsaFX then perform all the following events:
Actions
Change the fill color of the squares or the circle that painted in the pane.
Let the user choose the shape from the ComBobox
Change the color of the selected shape using the RadioButton
Add a white Stroke around the selected shape from the ComboBox if the user select the "Add Stroke?" CheckBox and remove the stroke if the user unselect the CheckBox.
Reset the color for all the shapes to Black and the Stroke of the circle to white if the user clicks on the "Reset colors" Button.
Add a KeyEvent that moves the circle left, right, up and down using the keyboard arrows.
Add a MouseEvent on the pane of the shapes. If the user clicks on any free space within the pane border, the background color of the pane will be changed to "black" color.
Event type
ActionEvent on the RadioButtons
ActionEvent on the "Add Stroke?" CheckBox
ActionEvent on the "Reset colors" Button
KeyEvent on the scene or root and make the focus on the circle.
MouseEvent on the pane.
Extra:
Try to let the user choose the shape by mouse instead of select it from the ComboBox then change the color and Stroke after that.
Hint:
Use an object from Pane layout to move the circle using the keyboard arrows.
Use method consume from the KeyEvent class to prevent the default KeyEvent processed on the ComboBox control.
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