/** * Sets the algorithm which should be used to paint the background of the owner. * @param background the background algorithm, can be <code>null</code> * @param backgroundComponent the source of <code>background</code>. Must not be <code>null</code> if * <code>background</code> is not <code>null</code>, must represents {@link #getOwner()} as {@link Component}. */ public void setBackground( BackgroundPaint background, BackgroundComponent backgroundComponent ){ if( this.background != background ){ if( background != null ){ if( backgroundComponent == null ){ throw new IllegalArgumentException( "backgroundComponent must not be null" ); } if( backgroundComponent.getComponent() != getOwner() ){ throw new IllegalArgumentException( "backgroundComponent must exactly represent 'getOwner()'" ); } } BackgroundPaint old = this.background; this.background = background; this.backgroundComponent = backgroundComponent; for( BasicButtonModelListener listener : listeners() ){ listener.backgroundChanged( this, old, background ); } } }