Is there any way to set multiple different "variables" into one column of a tableview in javafx?

96 Views Asked by At

Not sure if variables is the right word here...

I have a tableview that is to be populated with Client objects. Each Client object has an int id, a companyName, a firstName and a lastName The tableview only has 2 columns (one for the clientId and the other for the name of the client).

Now I was able to construct the table and have it auto populate with the Clients' id's and companyNames but I end up in a situation where if a client doesn't have a companyName, then that particular cell will not show any text. I was wondering, is there a way to have the tableview use the Client's firstName or lastName given that the Client doesn't have a companyName?

Any advice will be greatly appreciated and I appologize if I wasn't able to ask a proper question.

I can try removing the Client's companyName, firstName and lastName sections and replace them with just a single name category but that's a rather uninspired solution to the problem.

0

There are 0 best solutions below