void () { int currwidth = getWidth(); if (myWrapsCalculated) { if (currwidth == myWrapsCalculatedForWidth) { return; } else { myWrapsCalculated = false; } } int wrapsCount = calculateWraps(currwidth); myTooSmall = (wrapsCount == -1); if (myTooSmall) { wrapsCount = myTextLength; } int fontHeight = getCurrFontMetrics().getHeight(); myHeightCalculated = wrapsCount * fontHeight + myTextInsets.top + myTextInsets.bottom; myHeightCalculated = Math.max(myMinHeight, myHeightCalculated); int maxWidth = 0; for (int i=0; i < myWraps.size(); i++) { String s = (String)myWraps.get(i); int width = getCurrFontMetrics().stringWidth(s); maxWidth = Math.max(maxWidth, width); } myWrapsCalculatedForWidth = myTextInsets.left + maxWidth + myTextInsets.right; myWrapsCalculated = true; }