public void paintIcon(Component c, Graphics g, int x, int y) { super.paintIcon(c, g, x, y); Dimension d = new Dimension(getIconWidth(), getIconHeight()); for (Icon icon : iconSet) { Dimension id = new Dimension(icon.getIconWidth(), icon.getIconHeight()); int dx = (d.width - id.width)/2; int dy = (d.height - id.height)/2; icon.paintIcon(c, g, x+dx, y+dy); } }
public void paintIcon(Component c, Graphics g, int x, int y) { super.paintIcon(c, g, x, y); Dimension d = new Dimension(getIconWidth(), getIconHeight()); for (Icon icon : iconSet) { Dimension id = new Dimension(icon.getIconWidth(), icon.getIconHeight()); int dx = (d.width - id.width) / 2; int dy = (d.height - id.height) / 2; icon.paintIcon(c, g, x + dx, y + dy); } }