• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

empty JTable

 
Vijay
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Nam Ha Minh
Ranch Hand
Posts: 502
Eclipse IDE Firefox Browser Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
First, I suggest you to use a TableModel (e.g. AbstractTableModel) to separate data from the GUI.
 
Rob Camick
Ranch Hand
Posts: 2599
9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can temporarily add the label to the table:



Then when you start adding data to the table you would need to remove the label from the table.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic