------- 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.
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 ?
I have a JTable whose values gets filled only dynamically. At times, when the table is empty, I want to show a message like "no records found" just under the table header. Just like how in windows machine, when you make a search and if it doesnt return any records, it prints "Search is complete. There are no results to display" (stretching many columns) under the table header. I considered using JLabel (as shown below) but there is always some space b/w the two components. Let me know ur suggestions. Until then, lemme try out other Layout managers. Just a code snippet:
(N. Pruett - fixed page-widening code.) [ March 08, 2004: Message edited by: Nathan Pruett ]