Java table for multiple datasets

I'm currently creating a Java GUI application, and I'm going to implement something that seems to require a lot of reflection, at least for someone relatively inexperienced like me.

Situation

looks like this: I have a Customerdomain level class that contains a set of tasks, which is also a class ( Job). The application is intended for a fictitious horticultural company that wants to manage its customers and complete the tasks that it does for them.

At the GUI level, I have a jList for all clients, with a custom listmodel that extends AbstractListModel. This part of my application works fine, I can easily add / edit / delete clients and how it should be.

purpose

Now you need to implement jTable , which should show tasks for the client selected in jList .

No doubt I need a custom TableModelquestion: where to get the data from? It should be noted that the collection of tasks in the class Customeris ArrayList, and the class does not have a method that returns this ArrayList directly, it is possible to get a copy, since I do not want it to mutate the collection in the class directly from the public context.

My idea

, tablemodel Customer. jList , , jTable Job, . // , tablemodel first, Customer ( ).

? , , , - Job tablemodel, Customer Job . ? , .

()

Collection java. ArrayList, , Customer () . ?

+3
1

, , .

  • , . 3- , , ( , Google ), , Customer, Job,
  • , Job Customer,
  • , ui, , Customer

, ///. Customer , TableModel. TableModel Customer , /// . , , .

, . Customer - , JTable - ( MVC). , JTable (a TableModel), .

+2

All Articles