Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use the Project with the classes and interfaces created and used in class and implement the following additional features: The user can click delete selected.

Use the Project with the classes and interfaces created and used in class and implement the following additional features:

The user can click delete selected. That will remove the currently selected employee from the list.

The user can click clear. That will clear all the controls (first name, last name, is active).

The user can click add new. That will take the information currently present in the controls for first name, last name, and isActive, and will create and add a new employee with those attributes to the list. image text in transcribed

I have uploaded the code to github

https://github.comrali3avin

Using Java FX --Controller.java--

package sample; import com.sun.corba.se.spi.orbutil.threadpool.Work; import javafx.beans.value.ObservableValue; import javafx.collections.ObservableList; import javafx.fxml.FXML; import javafx.fxml.Initializable; import javafx.scene.control.CheckBox; import javafx.scene.control.ListView; import javafx.scene.control.TextField; import java.net.URL; import java.util.ResourceBundle; public class Controller implements Initializable { @FXML private ListView employeeListView; @FXML private TextField firstNameTextField; @FXML private TextField lastNameTextField; @FXML private CheckBox isActiveCheckBox; @Override public void initialize(URL location, ResourceBundle resources) { employeeListView.getSelectionModel().selectedItemProperty().addListener(( ObservableValue  ov, Worker old_val, Worker new_val)-> { Worker selectedItem = employeeListView.getSelectionModel().getSelectedItem(); firstNameTextField.setText(((Employee)selectedItem).firstName); lastNameTextField.setText(((Employee)selectedItem).lastName); isActiveCheckBox.setSelected(((Employee)selectedItem).isActive); } ); ObservableList items = employeeListView.getItems(); Employee employee1 = new Employee(); Employee employee2 = new Employee(); employee1.firstName = "Robert"; employee1.lastName = "Smith"; employee2.firstName = "Lisa"; employee2.lastName = "Smith"; items.add(employee1); items.add(employee2); for(int i = 0; i  
package sample; import java.util.UUID; public class Employee implements Worker { public String firstName; public String lastName; public UUID id; public boolean isActive; @Override public String toString() { return this.firstName + " " + this.lastName; } @Override public void hire() { isActive = true; } @Override public void fire() { isActive = false; } } 
--Faculty.java--
package sample; public class Faculty extends Employee { public String officeHours; } 

--Main.java--

package sample; import javafx.application.Application; import javafx.fxml.FXMLLoader; import javafx.scene.Parent; import javafx.scene.Scene; import javafx.stage.Stage; public class Main extends Application { @Override public void start(Stage primaryStage) throws Exception{ Parent root = FXMLLoader.load(getClass().getResource("sample.fxml")); primaryStage.setTitle("Employee Manager 2000"); Scene myScene = new Scene(root, 800, 600); primaryStage.setScene(myScene); primaryStage.show(); } public static void main(String[] args) { launch(args); } } 

--Staff.java--

package sample; public class Staff extends Employee { public int accessLevel; } 

--Worker.java--

package sample; public interface Worker { public void hire(); public void fire(); } 

--sample.fxml--

 
- --------- Exercise 1 of 2: Use the Project with the classes and interfaces created and used in class and implement the following additional features: First Name: ** ****- Last Name: Is Active: -- list of employees clear add new ------ -- --------- --------- delete selected -------- The user can click "delete selected". That will remove the currently selected employee from the list. The user can click "clear". That will clear all the controls (first name, last name, is active). The user can click "add new". That will take the information currently present in the controls for first name, last name, and isActive, and will create and add a new employee with those attributes to the list. ------------ --------- --------- ---------------- 0---------------------------------------------- - --------- Exercise 1 of 2: Use the Project with the classes and interfaces created and used in class and implement the following additional features: First Name: ** ****- Last Name: Is Active: -- list of employees clear add new ------ -- --------- --------- delete selected -------- The user can click "delete selected". That will remove the currently selected employee from the list. The user can click "clear". That will clear all the controls (first name, last name, is active). The user can click "add new". That will take the information currently present in the controls for first name, last name, and isActive, and will create and add a new employee with those attributes to the list. ------------ --------- --------- ---------------- 0

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions

Question

Define nonparametric statistics.

Answered: 1 week ago