/** * Gets the icon which should be painted on the view. * @return the icon to paint, can be <code>null</code> */ public Icon getPaintIcon(){ return getPaintIcon( isEnabled() ); }
public void paintIcon( Component c, Graphics g, int x, int y ){ Icon icon = model.getPaintIcon(); if( icon != null ){ Dimension min = getMinimumIconSize(); Dimension max = model.getMaxIconSize(); int dx = (Math.max( max.width, min.width ) - icon.getIconWidth()) / 2; int dy = (Math.max( max.height, min.height ) - icon.getIconHeight()) / 2; icon.paintIcon( c, g, x+dx, y+dy ); } }
public void paintIcon( Component c, Graphics g, int x, int y ){ Icon icon = model.getPaintIcon(); if( icon != null ){ Dimension min = getMinimumIconSize(); Dimension max = model.getMaxIconSize(); int dx = (Math.max( max.width, min.width ) - icon.getIconWidth()) / 2; int dy = (Math.max( max.height, min.height ) - icon.getIconHeight()) / 2; icon.paintIcon( c, g, x+dx, y+dy ); } }
@Override public Icon getPaintIcon() { return super.getPaintIcon( isEnabled() && isSelectionEnabled() ); }