aspose file tools*
The moose likes Swing / AWT / SWT and the fly likes JTable and data binding problem [please close, found solution] Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark "JTable and data binding problem [please close, found solution]" Watch "JTable and data binding problem [please close, found solution]" New topic
Author

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

Bartek Myszkowski
Ranch Hand

Joined: Feb 03, 2009
Posts: 44
Hello,

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: http://www.fdasfdas.prv.pl/JTableBindProblem.zip

@edit
Found solution on my own here:
http://swinglabs.org/docs/presentations/2007/DesktopMatters/beans-binding-talk.pdf
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: JTable and data binding problem [please close, found solution]