Here you can find the source of updateSize(AbstractButton button, Dimension size)
private static void updateSize(AbstractButton button, Dimension size)
//package com.java2s; import java.awt.Dimension; import javax.swing.AbstractButton; import javax.swing.Icon; public class Main { private static void updateSize(AbstractButton button, Dimension size) { Icon icon = button.getIcon(); if (icon != null) { size.width = Math.max(size.width, icon.getIconWidth()); size.height = Math.max(size.height, icon.getIconHeight()); }/*from w w w . java 2 s.co m*/ } }