@Override
  public void paintIcon(Component c, Graphics g, int x, int y) {
    int offsetX;
    int offsetY;

    if (myCenteredInComponent) {
      final Dimension size = c.getSize();
      offsetX = size.width / 2 - myIcon.getIconWidth() / 2;
      offsetY = size.height / 2 - myIcon.getIconHeight() / 2;
    }
    else {
      offsetX = (myWidth - myIcon.getIconWidth()) / 2;
      offsetY = (myHeight - myIcon.getIconHeight()) / 2;
    }

    myIcon.paintIcon(c, g, x + offsetX, y + offsetY);
  }
@Override
  public void paintIcon(Component c, Graphics g, int x, int y)