work out the calculate the size of the icon using the fontmetrics of the font . concode_field_sep Font font concode_elem_sep JComponent component concode_elem_sep int iconHeight concode_elem_sep int iconWidth concode_elem_sep String text concode_elem_sep Color foreground concode_field_sep Color getForeground concode_elem_sep int getIconWidth concode_elem_sep int getIconHeight concode_elem_sep String getText concode_elem_sep void setForeground concode_elem_sep void propertyChange concode_elem_sep void paintIcon concode_elem_sep void setText
void function ( ) { FontMetrics loc0 = component . getFontMetrics ( font ) ; iconWidth = loc0 . stringWidth ( text ) ; iconHeight = loc0 . getHeight ( ) ; component . revalidate ( ) ; }