Are you a JavaFX developer or a beginner in Java? This is a one problem Java developers facing most commonly. When you load data into a TableView, there are so many ways to do it and the lists contain custom objects(classes) can be difficult to bind. I will show you every step you want to get into success. You can read this carefully and your solution would apply easily in your own way. This is the easiest way.
- Create a Empoloyee.java Class as Follows.
public class Employee {
private String name;
private int salary; Employee(String name, int salary){ this.name = name;
this.salary = salary; } public String getName() {
return name;
} public void setName(String name) {
this.name = name;
} public int getSalary() {
return salary;
} public void setSalary(int salary) {
this.salary = salary;
}
}
- Create an Employee data list and add into an Employees list
Here you create an Employee List and add some employee objects to it. We will display those data using a TableView. This code block shows your main()…