Sometimes an application needs to keep some events from being processed normally by a component. For example, a visual interface builder might need to allow a user to drag a button around the screen. In this case, you wouldn't want the mouse press to activate the button.
You can consume an InputEvent
, that is a
MouseEvent
or a KeyEvent
, by calling its
consume()
method:
public void consume()
Once an InputEvent
is consumed, the source
component will not process the event itself. However, the event
will still be dispatched to all registered listeners.