* Mouse event for the model synchronization.
*/
private void syncMouseMovement(MouseEvent e) {
AbstractCommandButton b = (AbstractCommandButton) e.getSource();
ButtonModel actionModel = b.getActionModel();
PopupButtonModel popupModel = (b instanceof JCommandButton) ? ((JCommandButton) b)
.getPopupModel()
: null;
CommandButtonUI ui = b.getUI();
Rectangle actionRect = ui.getLayoutInfo().actionClickArea;
Rectangle popupRect = ui.getLayoutInfo().popupClickArea;
if ((actionRect != null) && actionRect.contains(e.getPoint())) {
if (actionModel.isEnabled()) {
if (!SwingUtilities.isLeftMouseButton(e))
actionModel.setRollover(true);
if (actionModel.isPressed())
actionModel.setArmed(true);
}
if (popupModel != null && !SwingUtilities.isLeftMouseButton(e))
popupModel.setRollover(false);
} else {
if ((popupRect != null) && popupRect.contains(e.getPoint())) {
if ((popupModel != null) && popupModel.isEnabled()) {
if (!SwingUtilities.isLeftMouseButton(e))
popupModel.setRollover(true);
if (popupModel.isPressed())
popupModel.setArmed(true);
}
if (!SwingUtilities.isLeftMouseButton(e))
actionModel.setRollover(false);
}
}