Merging And Splitting

Reply

Join Date: Jun 2004
Posts: 609
Reputation: freesoft_2000 is an unknown quantity at this point 
Solved Threads: 8
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Merging And Splitting

 
0
  #1
Feb 5th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Merging And Splitting

 
0
  #2
Feb 5th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Jun 2004
Posts: 609
Reputation: freesoft_2000 is an unknown quantity at this point 
Solved Threads: 8
freesoft_2000 freesoft_2000 is offline Offline
Practically a Master Poster

Re: Merging And Splitting

 
0
  #3
Feb 5th, 2005
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
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Merging And Splitting

 
0
  #4
Feb 5th, 2005
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.
Reply With Quote Quick reply to this message  
Join Date: Nov 2004
Posts: 6,143
Reputation: jwenting is just really nice jwenting is just really nice jwenting is just really nice jwenting is just really nice 
Solved Threads: 213
Team Colleague
jwenting's Avatar
jwenting jwenting is offline Offline
duckman

Re: Merging And Splitting

 
0
  #5
Feb 5th, 2005
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.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Similar Threads
Other Threads in the Java Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC