0

I have a table from my SQL server and I have connected to and and stored all the data in a linked list. I now want to take that data from the linked list created (everything works fine) but when I try to store it in my table named customerTable it doesn't recognize my table. (My GUI is on a different class, so is my linked list and my customer object that I use to initialize get, set methods, so I think it has something to do with that)

Can anybody help me understand how I do this?

I use this code:

DefaultTableModel model = (DefaultTableModel) customerTable.getModel();
  • Possible duplicate of [How Can I Show My Doubly LinkedList Data in a JTable?](https://stackoverflow.com/questions/26948509/how-can-i-show-my-doubly-linkedlist-data-in-a-jtable) – Rossiar Jul 14 '17 at 10:00

2 Answers2

0

You should implement interface TableModel, to use your existing list as the back of the table model.

See How to Use Tables of the Java Tutorials, on creating table models.

Usagi Miyamoto
  • 6,196
  • 1
  • 19
  • 33
0

so is my linked list and my customer object that I use to initialize get, set methods

If you are storing the data in a custom Object, then you need to create a custom TableModel for that Object.

Check out Row Table Model for a step-by-step example on how to create this custom TableModel for your object.

camickr
  • 321,443
  • 19
  • 166
  • 288