This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
Can somebody give me an idea of how to go about creating a table like shown below: _______________________________________________ | column1 | column2 | column 3| Column4 | _______________________________________________ | **** This row has some string info in it ***| ________________________________________________ | value1 | value2 | value3 | value4 | ________________________________________________ | valuei | value j | valuek | valuez | _________________________________________________
I need to add that line of text in between the header and the content. How to go about it ? Should that line be a part of JTableHeader or should I need to span over the cells of the content ?
It would be *a lot* easier just to put a string above the table headers... is there any really special reason to put it below the headers?
Thanks! and welcome to the JavaRanch! [ March 18, 2004: Message edited by: Nathan Pruett ]
Write once, run anywhere, because there's nowhere to hide! - /. A.C.
Joined: Mar 05, 2004
------- Quote: It would be *a lot* easier just to put a string above the table headers... is there any really special reason to put it below the headers? ------ Thanks for ur response. Yes, a JLabel would just suffice in ur case. But I need to display an info like " No records are available for this table" when there are no rows. Now, again I can do a setPreferredViewPortSize() of the JTable and add a JLabel under the JTable. But I have atleast 50 tables in my code. And I dont want to goto every place and add those lines of code. Instead I want to generalize and put my string info in my "generalized" MyJTable or MyHeaderCellRenderer,etc (which extends JTable, TableCellRenderer,etc) well, after some googling, I was able to get some hint. Can someone ,now, have a look into it and help me out. This one is for cell spanning: http://www.codeguru.com/java/articles/139.shtml This one can be referred for placing the String in Header ( I prefer it to be here) http://www.codeguru.com/java/articles/124.shtml Hoping for a reply (suggestion/code snippet) from JGurus!. Thanks.