Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Split a cell into two in a JTable

843806Jul 18 2009 — edited Jul 18 2009
Hi,

I am trying to do the following:

At the moment my table looks like this

Heading 1 | Heading 2
Text.........| Text
Text.........| Text

However, I would like to do the following:

Heading 1 | Heading 2
Text | Text | Text | Text
Text | Text | Text | Text

My code at the moment is this:

mytable = new javax.swing.JTable();

mytable.setModel(myModel);

mytable.getTableHeader().setReorderingAllowed(false);

jScrollPane1.setViewportView(mytable);



What do I need to do to get the outcome I'm trying to achieve?

I have seen several examples on the web when searching google but I don't really understand them. I have also tried several of them but they didn't work for me.

I am not asking for someone to do it all for me but could someone give a very detailed example with explanations to each part and maybe sample code?

Thanks

Edited by: surfi2000 on Jul 18, 2009 2:38 PM
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 15 2009
Added on Jul 18 2009
1 comment
1,123 views