Results 1 to 9 of 9
Thread: JTable Cell Merg
- 01-25-2010, 03:55 PM #1
Member
- Join Date
- Oct 2009
- Posts
- 88
- Rep Power
- 0
-
Moving to Swing forum for better topic alignment.
- 01-25-2010, 04:42 PM #3
Senior Member
- Join Date
- Aug 2009
- Location
- Pittsburgh, PA
- Posts
- 282
- Rep Power
- 4
cells cannot be merged in JTable
Here is how to make it look like cells are merged:
Suppose cells [r,c] and [r,c+1] are to be merged.
Install a cell renderer for the table.
To render either of the two merged cells,
render the contents to an offscreen buffer.
Then copy the lefthalf of the buffer for [r,c]
and the right half for [r+1,c].
You would have to setIntercellSpacing(new Dimension(0,0))
so there is no border between the two cells.
Obviously this will impact the appearance of the entire table.
The ugliness of this kluge suggests that you rethink the need to merge cells.
Maybe you want a GridBagLayout.
- 01-25-2010, 06:17 PM #4
Member
- Join Date
- Oct 2009
- Posts
- 88
- Rep Power
- 0
can u give the code for this plz... ZWeibieren
-
If you read his post carefully, I think he is telling your specifically not to do this. I have to say that your post is a bit short on important details that are necessary to give a good answer. So instead of asking for spoon-fed code, why not tell us exactly what you're trying to do here, and perhaps we can give you better alternatives?
A useful link I think: How to ask smart questions
- 01-25-2010, 06:43 PM #6
Senior Member
- Join Date
- Aug 2009
- Location
- Pittsburgh, PA
- Posts
- 282
- Rep Power
- 4
Yes, I could give you the code for the kludge. But I'm a bit tied up at the moment.
Besides, if you can't do offscreen buffers (create, draw on, crop) and cell renderers,
it is not a good idea for you to venture into the inevitable morass.
- 01-26-2010, 05:22 AM #7
Member
- Join Date
- Oct 2009
- Posts
- 88
- Rep Power
- 0
Sorry i think it is not good to implement stopping this thread thanks for help
- 04-25-2011, 06:40 AM #8
Member
- Join Date
- Apr 2011
- Posts
- 1
- Rep Power
- 0
row header in jtable
Hi,
I want to separate the rows in a jtable and give a heading to the set of rows. so i want to merge cells in a jtable. is there any way that i can achieve this.
- 04-25-2011, 09:32 AM #9
Senior Member
- Join Date
- Aug 2009
- Location
- Pittsburgh, PA
- Posts
- 282
- Rep Power
- 4
Similar Threads
-
Merg JTABLE CELL
By anilkumar_vist in forum New To JavaReplies: 1Last Post: 01-25-2010, 04:02 PM -
Jtable and cell coordinates
By rattaman in forum AWT / SwingReplies: 2Last Post: 11-17-2009, 05:48 PM -
jtable cell renderer
By ankitmcgill in forum New To JavaReplies: 2Last Post: 05-22-2009, 01:08 AM -
jTable Cell editing
By mahaling_m in forum AWT / SwingReplies: 0Last Post: 06-23-2008, 08:17 AM -
Jframe In Jtable cell
By Clarion in forum AWT / SwingReplies: 4Last Post: 06-23-2008, 04:42 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks