void (Component c, Graphics g, int x, int y) { Icon icon = myScaledIcon(); double dx = scaleVal(myWidth) - icon.getIconWidth(); double dy = scaleVal(myHeight) - icon.getIconHeight(); if (dx > 0 || dy > 0) { icon.paintIcon(c, g, x + (int)floor(dx / 2), y + (int)floor(dy / 2)); } else { icon.paintIcon(c, g, x, y); } }