Need help in JavaFX. Thank you in adavance

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

Need help in JavaFX. Thank you in adavance

Post by answerhappygod »

Need help in JavaFX. Thank you in adavance
Need Help In Javafx Thank You In Adavance 1
Need Help In Javafx Thank You In Adavance 1 (88.03 KiB) Viewed 53 times
Need Help In Javafx Thank You In Adavance 2
Need Help In Javafx Thank You In Adavance 2 (84.68 KiB) Viewed 53 times
Need Help In Javafx Thank You In Adavance 3
Need Help In Javafx Thank You In Adavance 3 (45.9 KiB) Viewed 53 times
Assignment 5 1. Create a Student class with instance variables name, id, and gpa. In a test class called Assignment5_1.java create a number of students and add them in a HashMap. To test your code print out all the information about the students as listed in the HashMap. Use a for-each loop for this purpose. The output should be similar to the following. Note that HashMap does not guarantee order. Abby Bob Chuck (111111): 3.1 (222222): 3.2 (333333): 3.3 2. In a new file called Assignments_2.java use GridPane, Label, TextField, Button, CheckBox, ComboBox, and Insets classes to create a window as depicted here: Assignments D X ID: GPA: (dit Delete Student update Database Add/Modiy Save Database 3. Use the following code to place your nodes so you end up with a window that resembles the above picture. You can use your own dimensions if you prefer. comboBox idLabel idTextField gpaLabel spaTextField editcBox delete Button updateButton addButton saveButton .setPrefWidth (150); .setPrefWidth( 50); .setPrefWidth( 50); setPrefWidth( 50); .setPrefWidth( 50); setPrefWidth (150); setPrefWidth(150); setPrefWidth(150); setPrefWidth (150); setPrefWidth (150); pane.setPadding(new Insets (20,20,20,20)); pane.setHgap (20); pane.setVgap (20); Scene scene = new Scene (pane, 700, 200);

4. Move all node declarations to the class itself such as they are now instance variables of your class. Your class should start off like this: public class Assingment5_2 extends Application { GridPane pane = new GridPane(); Label idLabel = new Label ("ID: "); 5. Add a method called disableAll() that disables the ComboBox edit feature, the two TextFields, and all the buttons. Use the method setDisable(true) for everything else and comboBox.setEditable(true/false) for the comboBox. 6. Add a matching enableAll() method to enable all node. 7. Use Lambda Expression to catch the comboBox selection event and populate the two TextFields with student ID and GPA. Also, add this code to the method: if (selectedName == null) { return; } if (students.get (selectedName) == null) { return; } 8. After a selection is made, the window should look something like this: Assignment 5 D X Bob ID: 222222 GPA: 3.2 (dit Delete Student Update Database Add/Modify Save Database 9. Capture the Delete button events as follows: a. Get the ComboBox selection b. Remove the student from the HashMap by using students.remove(selectedName); c. Remove the item from the ComboBox by using comboBox.getItems ().remove (selectedName); d. Empty out the ID and GPA text fields. In other words, set their text to ".

10. Capture the Add button events as follows: a. Grab the ComboBox selection, b. Construct a new Student based on the selected name and the contents of the ID and GPA TextFields. Use Integer.valueof() and Double, valueof() class methods to extract the ID and GPA values from the TextFields. If the combo box does not include the new student's name, add it to the combo box. To do this use: C. if (comboBox.getItems ().contains (selectedName) == false) [ comboBox.getItems() .add(selectedName); 11. Capture the CheckBox events as follows: if (editcBox.isSelected()) enableAll(); 1 else disableAll(); }
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply