943,414 Members | Top Members by Rank

Ad:
  • Java Discussion Thread
  • Unsolved
  • Views: 5808
  • Java RSS
Feb 5th, 2005
0

Merging And Splitting

Expand Post »
Hi everyone,

I have a jtable and i need a way to be able to merge or to split the cells(both the rows and columns) selected by the user. I have seen the table model and jtable apis' and there seems to be nothing about this. I would appreciate it if someone could show me any codings or any link to any web page on how the splitting and merging of jtable cells whether it is a column or row.

Thank You

Yours Sincerely

Richard West
Similar Threads
Reputation Points: 25
Solved Threads: 10
Practically a Master Poster
freesoft_2000 is offline Offline
623 posts
since Jun 2004
Feb 5th, 2005
0

Re: Merging And Splitting

You'd have to replace the TableModel with a different one I think.
Or maybe just changing the underlying datastructures holding the header and row information on the fly and notifying the table would do the trick.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Feb 5th, 2005
0

Re: Merging And Splitting

Quote originally posted by jwenting ...
You'd have to replace the TableModel with a different one I think.
Or maybe just changing the underlying datastructures holding the header and row information on the fly and notifying the table would do the trick.

How would i go about doing that?

If possible could you explain in detail

Richard West
Reputation Points: 25
Solved Threads: 10
Practically a Master Poster
freesoft_2000 is offline Offline
623 posts
since Jun 2004
Feb 5th, 2005
0

Re: Merging And Splitting

My experience with Swing is rather limited and mainly theoretical.
I'm only now really starting to read up on it in preparation for the SCJD certification I'm planning to work towards over the next half year or so.

I guess you have a class derived from AbstractTableModel which you use to display your data?
You would have to make another class derived from AbstractTableModel which displays the same data in a different way.
That would enable you to combine the display of several columns into one.
To merge rows together you'd do something similar I guess.

You may need to explicitly tell the application to redraw the JTable, you'd need to try that.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004
Feb 5th, 2005
0

Re: Merging And Splitting

Of course to make that possible you first have to ensure your actual data is decoupled from your TableModel!

That's however easy to achieve using composition, effectively using the TableModel as a Decorator or Adapter pattern around the data.
Team Colleague
Reputation Points: 1658
Solved Threads: 331
duckman
jwenting is offline Offline
7,719 posts
since Nov 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in Java Forum Timeline: Java Help!!!
Next Thread in Java Forum Timeline: Looking for Web proxy in Java





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC