* @param toFill
* Rectangle for the background.
*/
protected void paintButtonBackground(Graphics graphics, Rectangle toFill) {
ButtonModel actionModel = this.commandButton.getActionModel();
PopupButtonModel popupModel = (this.commandButton instanceof JCommandButton) ? ((JCommandButton) this.commandButton)
.getPopupModel()
: null;
// first time - paint the full background passing both models
this.paintButtonBackground(graphics, toFill, actionModel, popupModel);
Rectangle actionArea = this.getLayoutInfo().actionClickArea;
Rectangle popupArea = this.getLayoutInfo().popupClickArea;
if ((actionArea != null) && !actionArea.isEmpty()) {
// now overlay the action area with the background matching action
// model
Graphics2D graphicsAction = (Graphics2D) graphics.create();
// System.out.println(actionArea);
graphicsAction.clip(actionArea);
float actionAlpha = 0.4f;
if ((popupModel != null) && !popupModel.isEnabled())
actionAlpha = 1.0f;
graphicsAction.setComposite(AlphaComposite.SrcOver
.derive(actionAlpha));
// System.out.println(graphicsAction.getClipBounds());
this.paintButtonBackground(graphicsAction, toFill, actionModel);