Dimension (FontMetrics fm, @Nls String [] strs) { int width = 0; for (@Nls String str : strs) { width = Math.max(width, SwingUtilities.computeStringWidth(fm, str)); } return new Dimension(width, fm.getHeight() * strs.length); }