• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

How do I call removeColumn by name?

 
Ranch Hand
Posts: 634
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

How do I call removeColumn by name?
I haven't manifest all the columns in my query.
In my Customer1, only customer codes, last names , first names , mobile phone numbers and net sales
for that customer are queried.
The BeanTableModel listed out all attributes in an unpredictable way, sometimes lastname is in column 3 and sometimes it is in column 6 etc
I also tried these


I refer "residence" as the name of attribute in the bean.

which results in
Exception in thread "AWT-EventQueue-0" java.lang.IllegalArgumentException: Identifier not found
at javax.swing.table.DefaultTableColumnModel.getColumnIndex(DefaultTableColumnModel.java:282)
Thanks
Jack

 
Rancher
Posts: 3244
30
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The BeanTableModel listed out all attributes in an unpredictable way



Yes, it uses reflection and reflection does not guarantee the order in which the fields are returned.

sometimes lastname is in column 3 and sometimes it is in column 6 etc



The order should be consistent. That is once you create a Bean the field names should be returned in the same order every time the code is executed. However, that doesn't really help you with your problem. So you need to read the blog entry. It suggests a way that you can resort the TableColumns so the data is displayed in the order you wish to see the data. You will need to follow the link to another blog entry.

How do I call removeColumn by name?



You use the "column name", not the property name. a TableColumnModel knows nothing about where the data came from, so why would it know the data came from a bean with the property name that you specified?
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic