int () { int result = -1; for (int row = 0; row < Math.min(getRowCount(), myMaxItemsForSizeCalculation); row++) { for (int column = 0; column < Math.min(getColumnCount(), myMaxItemsForSizeCalculation); column++) { final TableCellRenderer renderer = getCellRenderer(row, column); if (renderer != null) { final Object value = getValueAt(row, column); final Component component = renderer.getTableCellRendererComponent(this, value, true, true, row, column); if (component != null) { Dimension size = component.getPreferredSize(); result = Math.max(size.height, result); if (component instanceof JLabel && StringUtil.isEmpty(((JLabel)component).getText())) { String oldText = ((JLabel)component).getText(); try { //noinspection HardCodedStringLiteral ((JLabel)component).setText("Jj"); size = component.getPreferredSize(); result = Math.max(size.height, result); } finally { ((JLabel)component).setText(oldText); } } } } } } return result; }