Interface ButtonElement
- All Superinterfaces:
DomQueryable
,Element
,EventTarget
,Node
Button elements play a sound when clicked
-
Nested Class Summary
Nested ClassesModifier and TypeInterfaceDescriptionstatic final record
Button action.static enum
Button action typestatic enum
Button action trigger -
Method Summary
Modifier and TypeMethodDescription@Nullable ButtonElement.ButtonAction
Get the button action, shorthand for accessing theAttributes.BUTTON_ACTION
attribute's value.@NotNull ButtonElement.ButtonTrigger
Get the button trigger, used forgetAction()
.boolean
Test if the button is enabledvoid
setAction
(@Nullable ButtonElement.ButtonAction action) Set the button action, shorthand for setting theAttributes.BUTTON_ACTION
attribute's value.void
setEnabled
(boolean enabled) Set if the button is enabledvoid
setTrigger
(@Nullable ButtonElement.ButtonTrigger trigger) Set the button trigger, used forgetAction()
.Methods inherited from interface com.juliewoolie.dom.DomQueryable
getElementsByClassName, getElementsByTagName, querySelector, querySelectorAll
Methods inherited from interface com.juliewoolie.dom.Element
appendChild, appendElement, appendText, canHaveChildren, clearChildren, firstChild, forEachDescendant, getAttribute, getAttributeEntries, getAttributeNames, getChild, getChildCount, getChildren, getClassList, getClassName, getCurrentStyle, getId, getInlineStyle, getTagName, getTextContent, getTitleNode, getTooltip, hasAttribute, hasChild, hasChildren, indexOf, insertAfter, insertBefore, isDescendant, lastChild, matches, prependChild, removeAttribute, removeChild, removeChild, removeMatchingChildren, replaceChild, replaceChild, setAttribute, setClassName, setId, setTextContent, setTitleNode
Methods inherited from interface com.juliewoolie.dom.event.EventTarget
addEventListener, dispatchEvent, getOnAddAttribute, getOnAddOption, getOnAppendChild, getOnAttributeChange, getOnClick, getOnClosing, getOnInput, getOnLoaded, getOnMouseEnter, getOnMouseExit, getOnMouseMove, getOnOptionChange, getOnRemoveAttribute, getOnRemoveChild, getOnRemoveOption, getOnRightClick, getOnSetAttribute, getOnSetOption, getOnSpawned, onAddAttribute, onAddOption, onAppendChild, onAttributeChange, onClick, onClosing, onInput, onLoaded, onMouseEnter, onMouseExit, onMouseMove, onOptionChange, onRemoveAttribute, onRemoveChild, onRemoveOption, onRightClick, onSetAttribute, onSetOption, onSpawned, removeEventListener
Methods inherited from interface com.juliewoolie.dom.Node
enterVisitor, exitVisitor, getDepth, getOwningDocument, getParent, getRenderingBounds, getSiblingIndex, hasFlag, nextSibling, previousSibling
-
Method Details
-
isEnabled
boolean isEnabled()Test if the button is enabledShortcut for accessing the
Attributes.ENABLED
attribute.- Returns:
true
, if the button is enabled,false
otherwise.
-
setEnabled
void setEnabled(boolean enabled) Set if the button is enabledShortcut for setting the
Attributes.ENABLED
attribute.- Parameters:
enabled
-true
, if the button is enabled,false
otherwise.
-
getTrigger
Get the button trigger, used forgetAction()
.If the
Attributes.ACTION_TRIGGER
attribute is not set, this will default toButtonElement.ButtonTrigger.DEFAULT
.- Returns:
- Button trigger
-
setTrigger
Set the button trigger, used forgetAction()
.Shorthand for setting the
Attributes.ACTION_TRIGGER
attribute value.- Parameters:
trigger
- Trigger value
-
getAction
Get the button action, shorthand for accessing theAttributes.BUTTON_ACTION
attribute's value.The returned action is executed when the button is clicked with the same mouse button as
getTrigger()
.- Returns:
- Button action, or
null
, if the underlying attribute is not set.
-
setAction
Set the button action, shorthand for setting theAttributes.BUTTON_ACTION
attribute's value.The set action is executed when the button is clicked with the same mouse button as
getTrigger()
.- Parameters:
action
- Button action
-