• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

empty JTable

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
Ranch Hand
Posts: 530
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
First, I suggest you to use a TableModel (e.g. AbstractTableModel) to separate data from the GUI.
 
Rancher
Posts: 3324
32
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
You guys haven't done this much, have ya? I suggest you study this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic