Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

JTable and data binding problem [please close, found solution]  RSS feed

Bartek Myszkowski
Ranch Hand
Posts: 44
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

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)

NetBeans zipped project with isolated problem:

Found solution on my own here:
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!