Question: Please do this in java, and include comments and explanations. Also, has to import and implement JavaFX and use that. (20 pts) Design and implement

Please do this in java, and include comments and explanations. Also, has to import and implement JavaFX and use that.
Please do this in java, and include comments and explanations. Also, has
to import and implement JavaFX and use that. (20 pts) Design and
implement a GUI that changes the Label background color to the color

(20 pts) Design and implement a GUI that changes the Label background color to the color chosen by a user. Reference Figure 1 to construct the GUI. Create the class ColorSelectionGUI. The GUI consists of Labels, RadioButtons, and CheckBoxes. The application has four Labels located around the perimeter of the window: o "North, South, East, and West. o The String on the Label should be center-aligned. Initially select all four CheckBoxes that indicate the recoloring corresponding Labels. Set the initial background color of the four Labels to "cyan". o Or call the "Cyan RadioButton's click event manually (see the Hints section) Set the text color of each RadioButton to its associated color (see Hints section). Initially select the "Cyan RadioButton to "Cyan" RadioButtons should have radio button functionality (only one radio button can be selected at a time). Color Selection North West Locations Background Colors North Salmon South Spring Green East Orange West 1 Cyan East South Figure 1. Initial GUI before a user's interaction. (10 pts) Implement the following event handling class. When the user clicks a RadioButton, change the background color of all Labels according to the selected CheckBoxes. Only one event handler should be written and assigned to all RadioButtons. Reference the examples below: o Figure 2 shows the resulting GUI when the user selects the Spring Green" RadioButton with all CheckBoxes selected: Color Selection North West Locations Background Colors North Salmon South Spring Green East Orange West Cyan East South Figure 2. Select the "Spring Green background color. Figure 3 shows the resulting GUI when the user deselects "North and East" CheckBoxes and click the "Salmon RadioButton. Color Selection X North West Locations Background Colors North Salmon South Spring Green East Grange West Cyan East South Figure 3. Deselect "North" and "East" CheckBox, click "Salmon" RadioButton. Then the user only selects "East" CheckBox and click the "Blue" RadioButton. Color Selection North West Locations Background Colors North Salmon South Spring Green East Orange West South Figure 4. Select only "East" CheckBox, click "Orange RadioButton. Hints If you want to achieve the exact spacing of the provided GUI example, here are some formatting numbers that I used: All sections: Alignment: Pos.CENTER o Center section: Preferred size: 220 width, 160 height Horizontal gap: 15 Vertical gap: 4 North and South Labels: . Preferred size: primaryStage.getWidth() width, 40 height You must use this after primaryStage.show() to get the displayed window width. Alignment: Pos.CENTER o East and West Labels: Preferred size: 40 width, primaryStage getHeight() - 80 height You must use this after primary Stage show to get the displayed window height Alignment: Pos.CENTER If you don't want to set the background color of every Label individually at the beginning, you can call the "Cyan" RadioButton's Action Event manually using this method (after assigning it the proper event handler): ocyando.fireEvent(new ActionEvent()); Since all CheckBoxes are checked initially, this will set all background colors. To set the background color of a control, use the setStyle method: o Ex. northLbl.setStyle("-fx-background-color: springgreen"); To set the text color of a RadioButton or CheckBox, use setStyle(): Ex. salmonRdo.setStyl(-fx-text-fill: salmon")

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!