void (int button) { if (myState == STATE_INIT && (button == MouseEvent.BUTTON1 || button == MouseEvent.BUTTON3) && !myArea.isSelected(myComponent)) { performSelection(); } if (button == MouseEvent.BUTTON1) { if (myState == STATE_INIT) { myState = STATE_DRAG; } } else { if (button == MouseEvent.BUTTON3) { myState = STATE_NONE; } else { myState = STATE_INVALID; } handleInvalidInput(); } }