Interface ElementEvents
- All Known Implementing Classes:
GuiButton,GuiColourPicker,GuiColourPicker.ColourPreview,GuiColourPicker.SliderBG,GuiContextMenu,GuiDialog,GuiDVD,GuiElement,GuiEnergyBar,GuiEntityRenderer,GuiEventProvider,GuiFluidTank,GuiItemStack,GuiList,GuiManipulable,GuiProgressIcon,GuiRectangle,GuiScrolling,GuiSlider,GuiSlots,GuiText,GuiTextField,GuiTextList,GuiTexture
Created by brandon3055 on 09/08/2023
-
Method Summary
Modifier and TypeMethodDescriptiondefault booleandefault booleancharTyped(char character, int modifiers) Override this method to implement handling for the charTyped event.default booleancharTyped(char character, int modifiers, boolean consumed) Root handler for charTyped event.List<GuiElement<?>>default booleankeyPressed(int key, int scancode, int modifiers) Override this method to implement handling for the keyPressed event.default booleankeyPressed(int key, int scancode, int modifiers, boolean consumed) Root handler for keyPressed event.default booleankeyReleased(int key, int scancode, int modifiers) Override this method to implement handling for the keyReleased event.default booleankeyReleased(int key, int scancode, int modifiers, boolean consumed) Root handler for keyReleased event.default booleanmouseClicked(double mouseX, double mouseY, int button) Override this method to implement handling for the mouseClicked event.default booleanmouseClicked(double mouseX, double mouseY, int button, boolean consumed) Root handler for mouseClick event.default voidmouseMoved(double mouseX, double mouseY) Called whenever the cursor position changes.default booleanmouseReleased(double mouseX, double mouseY, int button) Override this method to implement handling for the mouseReleased event.default booleanmouseReleased(double mouseX, double mouseY, int button, boolean consumed) Root handler for mouseReleased event.default booleanmouseScrolled(double mouseX, double mouseY, double scroll) Override this method to implement handling for the mouseScrolled event.default booleanmouseScrolled(double mouseX, double mouseY, double scroll, boolean consumed) Root handler for mouseScrolled event.
-
Method Details
-
getChildren
List<GuiElement<?>> getChildren()- Returns:
- An unmodifiable list of all assigned child elements assigned to this parent. The list should be sorted in the order they were added.
-
mouseMoved
default void mouseMoved(double mouseX, double mouseY) Called whenever the cursor position changes. Vanillas mouseDragged is not passed through because it is redundant. All mouse drag functionality can be archived using available events.- Parameters:
mouseX- new mouse X positionmouseY- new mouse Y position
-
mouseClicked
default boolean mouseClicked(double mouseX, double mouseY, int button) Override this method to implement handling for the mouseClicked event. This event propagates through the entire gui element stack from top to bottom, If eny element consumes the event it will not propagate any further. For rare cases where you need to receive this even if it has been consumed, you can overridemouseClicked(double, double, int, boolean)Note: You do not need to call super when overriding this interface method.
- Parameters:
mouseX- Mouse X positionmouseY- Mouse Y positionbutton- Mouse Button- Returns:
- true to consume event.
-
mouseClicked
default boolean mouseClicked(double mouseX, double mouseY, int button, boolean consumed) Root handler for mouseClick event. This method will always be called for all elements even if the event has already been consumed. There are a few uses for this method, but the fast majority of mouseClick handling should be implemented viamouseClicked(double, double, int)Note: If overriding this method, do so with caution, You must either return true (if you wish to consume the event) or you must return the result of the super call.
- Parameters:
mouseX- Mouse X positionmouseY- Mouse Y positionbutton- Mouse Buttonconsumed- Will be true if this action has already been consumed.- Returns:
- true if this event has been consumed.
-
mouseReleased
default boolean mouseReleased(double mouseX, double mouseY, int button) Override this method to implement handling for the mouseReleased event. This event propagates through the entire gui element stack from top to bottom, If eny element consumes the event it will not propagate any further. For rare cases where you need to receive this even if it has been consumed, you can overridemouseReleased(double, double, int, boolean)Note: You do not need to call super when overriding this interface method.
- Parameters:
mouseX- Mouse X positionmouseY- Mouse Y positionbutton- Mouse Button- Returns:
- true to consume event.
-
mouseReleased
default boolean mouseReleased(double mouseX, double mouseY, int button, boolean consumed) Root handler for mouseReleased event. This method will always be called for all elements even if the event has already been consumed. There are a few uses for this method, but the fast majority of mouseReleased handling should be implemented viamouseReleased(double, double, int)Note: If overriding this method, do so with caution, You must either return true (if you wish to consume the event) or you must return the result of the super call.
- Parameters:
mouseX- Mouse X positionmouseY- Mouse Y positionbutton- Mouse Buttonconsumed- Will be true if this action has already been consumed.- Returns:
- true if this event has been consumed.
-
mouseScrolled
default boolean mouseScrolled(double mouseX, double mouseY, double scroll) Override this method to implement handling for the mouseScrolled event. This event propagates through the entire gui element stack from top to bottom, If eny element consumes the event it will not propagate any further. For rare cases where you need to receive this even if it has been consumed, you can overridemouseScrolled(double, double, double, boolean)Note: You do not need to call super when overriding this interface method.
- Parameters:
mouseX- Mouse X positionmouseY- Mouse Y positionscroll- Scroll direction and amount- Returns:
- true to consume event.
-
mouseScrolled
default boolean mouseScrolled(double mouseX, double mouseY, double scroll, boolean consumed) Root handler for mouseScrolled event. This method will always be called for all elements even if the event has already been consumed. There are a few uses for this method, but the fast majority of mouseScrolled handling should be implemented viamouseScrolled(double, double, double)Note: If overriding this method, do so with caution, You must either return true (if you wish to consume the event) or you must return the result of the super call.
- Parameters:
mouseX- Mouse X positionmouseY- Mouse Y positionscroll- Scroll direction and amountconsumed- Will be true if this action has already been consumed.- Returns:
- true if this event has been consumed.
-
blockMouseEvents
default boolean blockMouseEvents()- Returns:
- True to prevent mouse events from being passed to elements bellow this element.
-
keyPressed
default boolean keyPressed(int key, int scancode, int modifiers) Override this method to implement handling for the keyPressed event. This event propagates through the entire gui element stack from top to bottom, If eny element consumes the event it will not propagate any further. For rare cases where you need to receive this even if it has been consumed, you can overridekeyPressed(int, int, int, boolean)Note: You do not need to call super when overriding this interface method.
- Parameters:
key- the keyboard key that was pressed.scancode- the system-specific scancode of the keymodifiers- bitfield describing which modifier keys were held down.- Returns:
- true to consume event.
-
keyPressed
default boolean keyPressed(int key, int scancode, int modifiers, boolean consumed) Root handler for keyPressed event. This method will always be called for all elements even if the event has already been consumed. There are a few uses for this method, but the fast majority of keyPressed handling should be implemented viakeyPressed(int, int, int)Note: If overriding this method, do so with caution, You must either return true (if you wish to consume the event) or you must return the result of the super call.
- Parameters:
key- the keyboard key that was pressed.scancode- the system-specific scancode of the keymodifiers- bitfield describing which modifier keys were held down.consumed- Will be true if this action has already been consumed.- Returns:
- true if this event has been consumed.
-
keyReleased
default boolean keyReleased(int key, int scancode, int modifiers) Override this method to implement handling for the keyReleased event. This event propagates through the entire gui element stack from top to bottom, If eny element consumes the event it will not propagate any further. For rare cases where you need to receive this even if it has been consumed, you can overridekeyReleased(int, int, int, boolean)Note: You do not need to call super when overriding this interface method.
- Parameters:
key- the keyboard key that was released.scancode- the system-specific scancode of the keymodifiers- bitfield describing which modifier keys were held down.- Returns:
- true to consume event.
-
keyReleased
default boolean keyReleased(int key, int scancode, int modifiers, boolean consumed) Root handler for keyReleased event. This method will always be called for all elements even if the event has already been consumed. There are a few uses for this method, but the fast majority of keyReleased handling should be implemented viakeyReleased(int, int, int)Note: If overriding this method, do so with caution, You must either return true (if you wish to consume the event) or you must return the result of the super call.
- Parameters:
key- the keyboard key that was released.scancode- the system-specific scancode of the keymodifiers- bitfield describing which modifier keys were held down.consumed- Will be true if this action has already been consumed.- Returns:
- true if this event has been consumed.
-
charTyped
default boolean charTyped(char character, int modifiers) Override this method to implement handling for the charTyped event. This event propagates through the entire gui element stack from top to bottom, If eny element consumes the event it will not propagate any further. For rare cases where you need to receive this even if it has been consumed, you can overridecharTyped(char, int, boolean)Note: You do not need to call super when overriding this interface method.
- Parameters:
character- The character typed.modifiers- bitfield describing which modifier keys were held down.- Returns:
- true to consume event.
-
charTyped
default boolean charTyped(char character, int modifiers, boolean consumed) Root handler for charTyped event. This method will always be called for all elements even if the event has already been consumed. There are a few uses for this method, but the fast majority of charTyped handling should be implemented viacharTyped(char, int)Note: If overriding this method, do so with caution, You must either return true (if you wish to consume the event) or you must return the result of the super call.
- Parameters:
character- The character typed.modifiers- bitfield describing which modifier keys were held down.consumed- Will be true if this action has already been consumed.- Returns:
- true if this event has been consumed.
-