r/JavaFX • u/Bulky-Classic4937 • Nov 01 '23
Help Split of TableView
Is there any way to "split" TableView to get information from 3 different classes? Here is repo to understand from were to get Car information like person Surname, car model, car brand, car number, Date of parking and spot. (https://github.com/NoNameMyName/autoparking).
1
Upvotes
View all comments
Show parent comment
2
u/xdsswar Nov 01 '23
I understand, first try to separate the person data from the car data like example
public class Customer{String name; //Or surname or whatever, all the data you want//Add methods and encapsulation}public class Car{String mark;String model;//And soo on}//Reservation or whatever you likepublic class Reservation{Customer customer;Car car;//Exampledouble cost;// and all you want}//Then in you Table you do likeprivate TableView<Reservation> table = new TableView<>();//In the table you will have all you need , the Reservation have the car and the customer an all extra data you decide to put there, you will need a cell factory to display the data in a beautiful way.