JTable and data binding problem [please close, found solution]
posted 6 years ago
I am using NetBeans 6.8 and got some problems when I want to add something to binded data. I have created a JTable (myListTable) that is binded with LinkedList<MyItem> (myList). I have created JButton (addRowButton) that should add new MyItem to myList which (probably) should add a row with that item to myListTable... and this is where the problem occurs. Firstly I have tried this:but got error java.lang.IndexOutOfBoundsException and I could not identify what causes it (probably it is because I have increased myList but myListTable does not have enough rows). So I made a small workaround:but now after adding a row, column name changes (don't know why it happens?!)
This is how MyItem is defined:Questions:
1. I would like to know is it possible to add data to bean that is binded to component? What is correct way of doing this?
2. Is my way of biniding correct? (I made it with tutorial from official netbeans site)