private static int visibleRowCount(JComponent c) {
    if (c instanceof JList) return getVisibleRowCount((JList<?>)c);
    if (c instanceof JTable) return getVisibleRowCount((JTable)c);
    return -1;
  }
private static int visibleRowCount(JComponent c)