private int heightHint(String text,int maxWidth,int maxHeight){
  Point fontPoint=gc.textExtent(text);
  int rows=(fontPoint.x / (maxWidth - 50)) + 1;
  return Math.min(rows * fontPoint.y,maxHeight);
}

private int heightHint ( String text , int maxWidth , int maxHeight ) { Point fontPoint = gc . textExtent ( text ) ; int rows = ( fontPoint . x / ( maxWidth - 50 ) ) + 1 ; return Math . min ( rows * fontPoint . y , maxHeight ) ; }
returns the height hint for the text that should fit into specified maximum width . if the calculated height hint is higher than the given max height , then max height is returned .
