APIdia Launch Partner
Top Description Fields Constructors Methods
com.badlogic.gdx.scenes.scene2d

public Class Event

extends Object
implements Poolable
Class Inheritance
All Implemented Interfaces
com.badlogic.gdx.utils.Pool.Poolable
Known Direct Subclasses
com.badlogic.gdx.scenes.scene2d.InputEvent, com.badlogic.gdx.scenes.scene2d.utils.ChangeListener.ChangeEvent, com.badlogic.gdx.scenes.scene2d.utils.FocusListener.FocusEvent
Imports
com.badlogic.gdx.InputProcessor, com.badlogic.gdx.utils.Pool.Poolable

The base class for all events.

By default an event will "bubble" up through an actor's parent's handlers (see setBubbles(boolean)).

An actor's capture listeners can stop() an event to prevent child actors from seeing it.

An Event may be marked as "handled" which will end its propagation outside of the Stage (see handle()). The default Actor#fire(Event) will mark events handled if an EventListener returns true.

A cancelled event will be stopped and handled. Additionally, many actors will undo the side-effects of a canceled event. (See cancel().)

See Also
InputEvent, Actor#fire(Event)

Field Summary

Modifier and TypeField and Description
private boolean
private boolean
private boolean
private boolean
private Actor
private Stage
private boolean
private Actor

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public void
cancel()

Marks this event cancelled.

public boolean
public Actor
getListenerActor()

Returns the actor that this listener is attached to.

public Stage
getStage()

The stage for the actor the event was fired on.

public Actor
getTarget()

Returns the actor that the event originated from.

public void
handle()

Marks this event as handled.

public boolean
public boolean
isCapture()

If true, the event was fired during the capture phase.

public boolean
public boolean
public void
reset()

Implements com.badlogic.gdx.utils.Pool.Poolable.reset.

Resets the object for reuse.

public void
setBubbles(boolean bubbles)

If true, after the event is fired on the target actor, it will also be fired on each of the parent actors, all the way to the root.

public void
setCapture(boolean capture)

public void
setListenerActor(Actor listenerActor)

public void
setStage(Stage stage)

public void
setTarget(Actor targetActor)

public void
stop()

Marks this event has being stopped.

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

bubblesback to summary
private boolean bubbles
cancelledback to summary
private boolean cancelled
captureback to summary
private boolean capture
handledback to summary
private boolean handled
listenerActorback to summary
private Actor listenerActor
stageback to summary
private Stage stage
stoppedback to summary
private boolean stopped
targetActorback to summary
private Actor targetActor

Constructor Detail

Eventback to summary
public Event()

Method Detail

cancelback to summary
public void cancel()

Marks this event cancelled. This handles the event and stops the event propagation. It also cancels any default action that would have been taken by the code that fired the event. Eg, if the event is for a checkbox being checked, cancelling the event could uncheck the checkbox.

getBubblesback to summary
public boolean getBubbles()
getListenerActorback to summary
public Actor getListenerActor()

Returns the actor that this listener is attached to.

getStageback to summary
public Stage getStage()

The stage for the actor the event was fired on.

getTargetback to summary
public Actor getTarget()

Returns the actor that the event originated from.

handleback to summary
public void handle()

Marks this event as handled. This does not affect event propagation inside scene2d, but causes the Stage InputProcessor methods to return true, which will eat the event so it is not passed on to the application under the stage.

isCancelledback to summary
public boolean isCancelled()
See Also
cancel()
isCaptureback to summary
public boolean isCapture()

If true, the event was fired during the capture phase.

See Also
Actor#fire(Event)
isHandledback to summary
public boolean isHandled()

handle()

isStoppedback to summary
public boolean isStopped()
See Also
stop()
resetback to summary
public void reset()

Implements com.badlogic.gdx.utils.Pool.Poolable.reset.

Doc from com.badlogic.gdx.utils.Pool.Poolable.reset.

Resets the object for reuse. Object references should be nulled and fields may be set to default values.

setBubblesback to summary
public void setBubbles(boolean bubbles)

If true, after the event is fired on the target actor, it will also be fired on each of the parent actors, all the way to the root.

setCaptureback to summary
public void setCapture(boolean capture)
setListenerActorback to summary
public void setListenerActor(Actor listenerActor)
setStageback to summary
public void setStage(Stage stage)
setTargetback to summary
public void setTarget(Actor targetActor)
stopback to summary
public void stop()

Marks this event has being stopped. This halts event propagation. Any other listeners on the listener actor are notified, but after that no other listeners are notified.