/** * Sets the icon which is normally shown on the view. * @param modifier the context in which to use the icon, not <code>null</code> * @param icon the new icon, can be <code>null</code> */ public void setIcon( ActionContentModifier modifier, Icon icon ){ Icon oldIcon = icons.remove( modifier ); if( icon == null ){ icons.remove( modifier ); } else{ icons.put( modifier, icon ); } disabledIcons.remove( modifier ); for( BasicButtonModelListener listener : listeners() ){ listener.iconChanged( this, modifier, oldIcon, icon ); } changed(); }
/** * Tells this model which orientation the {@link DockTitle} has, on which * the view of this model is displayed. * @param orientation the orientation, not <code>null</code> */ public void setOrientation( Orientation orientation ) { if( orientation == null ) throw new IllegalArgumentException( "Orientation must not be null" ); Orientation old = this.orientation; this.orientation = orientation; for( BasicButtonModelListener listener : listeners() ){ listener.orientationChanged( this, old, orientation ); } changed(); }
/** * Sets the text of this button, some button implementations may ignore the text. * @param text the new text, can be <code>null</code> */ public void setText( String text ){ String oldText = this.text; this.text = text; for( BasicButtonModelListener listener : listeners() ){ listener.textChanged( this, oldText, text ); } changed(); }
/** * Changes the <code>mouseInside</code> property. The property tells whether * the mouse is currently inside the border of the {@link #getOwner() owner} * or not. Clients should not call this method unless they handle all * mouse events. * @param mouseInside whether the mouse is inside */ protected void setMouseInside( boolean mouseInside ) { if( this.mouseInside != mouseInside ){ this.mouseInside = mouseInside; for( BasicButtonModelListener listener : listeners() ){ listener.mouseInside( this, mouseInside ); } changed(); } }
/** * Sets the <code>selected</code> property. The view may be painted in * a different way dependent on this value. * @param selected the new value */ public void setSelected( boolean selected ) { if( this.selected != selected ){ this.selected = selected; for( BasicButtonModelListener listener : listeners() ){ listener.selectedStateChanged( this, selected ); } changed(); } }
/** * Changes the <code>mousePressed</code> property. The property tells * whether the left mouse button is currently pressed or not. Clients * should not invoke this method unless they handle all mouse events. * @param mousePressed whether button 1 is pressed */ protected void setMousePressed( boolean mousePressed ) { if( this.mousePressed != mousePressed ){ this.mousePressed = mousePressed; for( BasicButtonModelListener listener : listeners() ){ listener.mousePressed( this, mousePressed ); } changed(); } }
/** * Sets the <code>enabled</code> property of this model. A model will not * react on a mouse-click if it is not enabled. * @param enabled the value */ public void setEnabled( boolean enabled ) { owner.setEnabled( enabled ); if( !enabled ){ setMousePressed( false ); } for( BasicButtonModelListener listener : listeners() ){ listener.enabledStateChanged( this, enabled ); } changed(); }