Search code examples
javaswingjtablerenderer

Centered JLabel inside JTable


How can I display a centered text or something similar inside a JTable if there are not results after a query? Thank you all.


Solution

  • I wouldn't show a Label inside the JTable, but instead the JTable.

    Try removing the table element from its container, and adding the Jlabel with the message.

    When the user runs another query, with positive results, do the opposite way (remove the label, add the table)