Reputation: 27
I didn't write any code yet, so sorry about that but need some direction and clarification before proceeding. Can I create a dynamic link between with a JTable and Hashmap? So when ever my listenrs add something new or delete something, it will update the Hashmap and that would update the JTable, I was thinking of re-creating the JTable everytime a change happens? That is one of my buttons being pressed.
Any suggestions?
Upvotes: 0
Views: 124
Reputation: 73558
A JTable
is just the visible component, the data is contained in a TableModel
. Any changes inside the model will be reflected in the JTable
itself. So you can create a TableModel
that uses a HashMap
internally.
Here's Oracle's table tutorial for more info
https://docs.oracle.com/javase/tutorial/uiswing/components/table.html
Upvotes: 2