boolean (JComponent component) { if (component instanceof JTable) return ((JTable)component).getRowCount() < 1; if (component instanceof JList) return ((JList<?>)component).getModel().getSize() <1; return false; }