Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

BeanTableModel column order problem

 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello,
I tried to write a SSCCE for the BeanTableModel, and I found that it is correct for a simple model like this.


But is in the wrong order in my major program I developed so far.
The bean attributes are in correct order
But I will get this, with netsales going first.









Just scratching my hair...
Thanks
Jack



column order.jpg
[Thumbnail for column order.jpg]
 
K. Tsang
Bartender
Posts: 3348
12
Android Java
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How is the BeanTableModel source look like? In it did you override the getColumnName() method?
 
Jacky Luk
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tsang,

http://tips4java.wordpress.com/2008/11/27/bean-table-model/

Oh.. do I need to? If so, I didn't override it, where should I do it?
I just did this.... that directly apply the BeanTableModel to the JTable after inserting the List of some classes
into the BeanTableModel.

Any pointers are welcome!

Thanks
 
K. Tsang
Bartender
Posts: 3348
12
Android Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
OK I see that BeanTableModel isn't part of Java API. So forget about what I said earlier.

You may able to utilize the sorting in BeanTableModel to get the correct order. How the columns are sorted will need to look at docs.
 
Rob Camick
Ranch Hand
Posts: 2542
9
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you ever pay any attention to what people say???

Do you ever respond to your old questions???

You asked this question in your last posting: http://www.coderanch.com/t/625763/GUI/java/call-removeColumn where you where given an answer.

Quit wasting peoples time by posting all these questions. Spend more time reading the answers you have already been given.

The answer to this question was given to you 4 days ago in the original blog entry if you took to the time to read the blog. You were then given an answer yesterday again explaining that the blog contained all the information you needed.
 
m Korbel
Ranch Hand
Posts: 174
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
- and JXTable has own model, sorter ...., there can be conflict with, but nobody knows

- can be ignored - one o version has own workaround, connector to Beans, you have to check change log, in older
vesion(s) too, but AFAIK Beans and cottons around is one of refused ways, the same as its parent JSR296
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic