Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

How to have JTable with cells spanning on multiple columns?

 
Ranch Hand
Posts: 50
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi my friends,

The question which I am going to post here was posted on Oracle Java forum about 2 weeks ago. However I did not get any answer so please allow me to re-post it here. Hope some experienced guys can help me.

I want to have my table with a cell spans on two columns, like merged cell in Excel.
I found an example here:

http://www.java2s.com/Code/Java/Swing-Components/MultiSpanCellTableExample.htm

But I were not able to get it works, it throws some exception at runtime:



Any help?

Many thanks,
Nam
 
Ranch Hand
Posts: 4632
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
some time back this was the fix (unsure if still relevant)

In class: AttributiveCellTableModel,
In method: public void setDataVector( Vector newData, Vector columnNames )

Change the line:
setColumnIdentifiers(columnNames);

To the line:
columnIdentifiers = columnNames;
 
Nam Ha
Ranch Hand
Posts: 50
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Micheal,

I followed you suggestion, and it worked!

Great!

Thanks a lot
 
Is this the real life? Is this just fantasy? Is this a tiny ad?
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic