I have JTable in my swing app. In case if model is empty (row count == 0) I want to show text "0 Results". How can I do this?
K.
I have JTable in my swing app. In case if model is empty (row count == 0) I want to show text "0 Results". How can I do this?
K.
if you extend AbstractTableModel
, as shown in this example, you can check the size of your chosen data structure and condition the overridden methods to return a single row and column having the desired value. For example,
@Override
public Object getValueAt(int row, int col) {
if (keys.length == 0) {
return "No results.";
}
...
}
Related changes would be required in the constructor and remaining methods getRowCount()
, getColumnCount()
and getColumnName()
.