@Override protected void changed( Color oldValue, Color newValue ){ if( oldValue != newValue ){ if( model.isEnabled() ){ setLabelForeground( newValue ); } } } };
@Override protected void changed( Color oldValue, Color newValue ){ if( oldValue != newValue ){ if( !model.isEnabled() ){ setLabelForeground( newValue ); } } } };
@Override protected void changed( Color oldValue, Color newValue ){ if( oldValue != newValue ){ if( model.isEnabled() ){ setLabelForeground( newValue ); } } } };
@Override protected void changed( Color oldValue, Color newValue ){ if( oldValue != newValue ){ if( !model.isEnabled() ){ setLabelForeground( newValue ); } } } };
/** * 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() ); }
@Override public void mouseReleased( MouseEvent e ) { if( mousePressed && e.getButton() == MouseEvent.BUTTON1 ){ boolean inside = owner.contains( e.getX(), e.getY() ); if( inside && isEnabled() ){ trigger(); } setMousePressed( false ); if( mouseInside != inside ) setMouseInside( inside ); } } }
/** * Sets the foreground color of the label. * @param color the new color, can be <code>null</code> */ public void setLabelForeground( Color color ){ if( color == null ){ label.setForeground( labelOriginalColor ); } else{ label.setForeground( color ); } foregroundColorSet = color != null; if( foregroundColorSet ){ label.setEnabled( true ); } else{ label.setEnabled( model.isEnabled() ); } }
/** * Sets the foreground color of the label. * @param color the new color, can be <code>null</code> */ public void setLabelForeground( Color color ){ if( color == null ){ label.setForeground( labelOriginalColor ); } else{ label.setForeground( color ); } foregroundColorSet = color != null; if( foregroundColorSet ){ label.setEnabled( true ); } else{ label.setEnabled( model.isEnabled() ); } }
/** * Changes the enable state of the label. */ public void updateLabelEnabled(){ boolean enabled = model.isEnabled(); if( textColor != null ){ if( enabled ){ setLabelForeground( textColor.color() ); } else{ setLabelForeground( textColorDisabled.color() ); } } else{ if( !foregroundColorSet ){ label.setEnabled( enabled ); } else{ label.setEnabled( true ); } } }
/** * Changes the enable state of the label. */ public void updateLabelEnabled(){ boolean enabled = model.isEnabled(); if( textColor != null ){ if( enabled ){ setLabelForeground( textColor.color() ); } else{ setLabelForeground( textColorDisabled.color() ); } } else{ if( !foregroundColorSet ){ label.setEnabled( enabled ); } else{ label.setEnabled( true ); } } }
boolean mouseEntered = model.isMouseInside(); boolean selected = model.isSelected(); boolean enabled = model.isEnabled();
/** * Updates the content (icon, text, orientation, ...) of this {@link MiniButtonContent}. */ protected void updateContent(){ if( model == null ){ label.setIcon( null ); label.setText( null ); label.setHorizontal( true ); label.setEnabled( true ); } else{ label.setIcon( new ForwardIcon() ); label.setText( model.getText() ); label.setHorizontal( model.getOrientation().isHorizontal() ); label.setEnabled( model.isEnabled() ); } }
/** * Updates the content (icon, text, orientation, ...) of this {@link MiniButtonContent}. */ protected void updateContent(){ if( model == null ){ label.setIcon( null ); label.setText( null ); label.setHorizontal( true ); label.setEnabled( true ); } else{ label.setIcon( new ForwardIcon() ); label.setText( model.getText() ); label.setHorizontal( model.getOrientation().isHorizontal() ); label.setEnabled( model.isEnabled() ); } }
/** * Changes the current border. Uses various states to determine the * correct border. */ protected void updateBorder(){ if( model.isEnabled() && model.isMousePressed() ){ if( model.isSelected() ) setBorder( getBorder( getMousePressedSelectedBorder(), borderKeyMousePressedSelected ) ); else setBorder( getBorder( getMousePressedBorder(), borderKeyMousePressed ) ); } else if( model.isEnabled() && model.isMouseInside() ){ if( model.isSelected() ) setBorder( getBorder( getMouseOverSelectedBorder(), borderKeyMouseOverSelected ) ); else setBorder( getBorder( getMouseOverBorder(), borderKeyMouseOver ) ); } else{ if( model.isSelected() ) setBorder( getBorder( getNormalSelectedBorder(), borderKeyNormalSelected ) ); else setBorder( getBorder( getNormalBorder(), borderKeyNormal ) ); } }