Package com.teamdev.jxbrowser.dom.event
Interface Event
- All Superinterfaces:
Event
- All Known Subinterfaces:
CustomEvent
,KeyEvent
,MouseEvent
,UiEventModifier
,WheelEvent
A DOM event, for example, mouse or keyboard event, provides access to the event data and methods
to change the event behavior.
-
Method Summary
Modifier and TypeMethodDescriptionReturns anOptional
that contains the event target that represents the element to which the event handler has been attached, otherwise an emptyOptional
.boolean
Returnstrue
if the event bubbles up through the DOM, otherwise false.boolean
Returnstrue
when the event can be canceled, and therefore prevented as if the event never happened.boolean
Returnstrue
if the event is trusted, and therefore was generated by a user action.phase()
Returns the event phase.void
Informs the browser that if the event is not explicitly handled, its default action should not be performed.void
Informs the browser that the event should not propagate in the capturing and bubbling phases.target()
Returns anOptional
that contains the element on which the event occurred if it exists, otherwise an emptyOptional
.type()
Returns the event type.
-
Method Details
-
type
EventType type()Returns the event type. -
target
Optional<EventTarget> target()Returns anOptional
that contains the element on which the event occurred if it exists, otherwise an emptyOptional
. -
currentTarget
Optional<EventTarget> currentTarget()Returns anOptional
that contains the event target that represents the element to which the event handler has been attached, otherwise an emptyOptional
. -
phase
EventPhase phase()Returns the event phase. -
isBubbles
boolean isBubbles()Returnstrue
if the event bubbles up through the DOM, otherwise false. -
isCancelable
boolean isCancelable()Returnstrue
when the event can be canceled, and therefore prevented as if the event never happened. In other case, returns false. -
isTrusted
boolean isTrusted()Returnstrue
if the event is trusted, and therefore was generated by a user action.- Since:
- 7.12
-
preventDefault
void preventDefault()Informs the browser that if the event is not explicitly handled, its default action should not be performed.For example, if you invoke this method for the event of the
EventType.CLICK
type, dispatching this event to the checkbox element as the eventcurrentTarget
will not toggle this checkbox.- Throws:
ObjectClosedException
- if the event is closed
-
stopPropagation
void stopPropagation()Informs the browser that the event should not propagate in the capturing and bubbling phases.- Throws:
ObjectClosedException
- if the event is closed
-