public class UIContextButton extends UI2dComponent implements UIFocus
Modifier and Type | Class and Description |
---|---|
static class |
UIContextButton.Direction
Direction that a context menu opens from a button
|
bottomMargin, height, leftMargin, rightMargin, textAlignHorizontal, textAlignVertical, textOffsetX, textOffsetY, topMargin, width, x, y
children, hasFocus, mousePressContextMenu, visible
Constructor and Description |
---|
UIContextButton(float x,
float y,
float w,
float h) |
Modifier and Type | Method and Description |
---|---|
UIContextMenu |
getContextMenu()
Accessor for the underlying context menu object
|
void |
onDraw(UI ui,
PGraphics pg)
Subclasses should override this method to perform their drawing functions.
|
void |
onKeyPressed(KeyEvent keyEvent,
char keyChar,
int keyCode)
Subclasses override to receive key events
|
void |
onMousePressed(MouseEvent mouseEvent,
float mx,
float my)
Subclasses override to receive mouse events
|
void |
onMouseReleased(MouseEvent mouseEvent,
float mx,
float my)
Subclasses override to receive mouse events
|
UIContextButton |
setContextActions(UIContextActions.Action[] contextActions)
Sets an array of actions that will be shown in the context menu that opens when
the button is clicked
|
UIContextButton |
setContextMenuWidth(float contextMenuWidth)
Sets the width of the context menu opened by this button
|
UIContextButton |
setDirection(UIContextButton.Direction direction)
Sets the direction in which the context menu opens
|
UIContextButton |
setLabel(String label)
Sets the label visible on the button
|
addToContainer, addToContainer, breakTextToWidth, clipTextToWidth, contains, drawBackground, drawBorder, drawFocus, drawFocusCorners, drawFocusCorners, getBackgroundColor, getBorderColor, getBorderRounding, getBorderWeight, getContainer, getFocusColor, getFocusSize, getFont, getFontColor, getHeight, getNextSibling, getParent, getPrevSibling, getWidth, getX, getY, hasBackground, hasBorder, hasFont, hasFontColor, isMappable, onResize, redraw, removeFromContainer, setBackground, setBackgroundColor, setBorder, setBorderColor, setBorderRounding, setBorderWeight, setBottomMargin, setContainerIndex, setDescription, setFocusBackground, setFocusBackgroundColor, setFocusColor, setFocusCorners, setFont, setFontColor, setFontColor, setHeight, setLeftMargin, setMappable, setMargin, setMargin, setMargin, setPosition, setPosition, setPosition, setPosition, setRightMargin, setSize, setTextAlignment, setTextAlignment, setTextOffset, setTopMargin, setVisible, setWidth, setX, setY
addLoopTask, beginDraw, blur, bringToFront, consumeKeyEvent, consumeMousePress, consumeMouseWheelEvent, endDraw, focus, getDescription, getFocusedChild, getLX, getUI, hasDirectFocus, hasFocus, isVisible, keyEventConsumed, loop, mousePressConsumed, onBlur, onFocus, onUIResize, removeLoopTask, toggleVisible
onKeyReleased, onKeyTyped, onMouseClicked, onMouseDragged, onMouseMoved, onMouseOut, onMouseOver, onMouseWheel
public UIContextMenu getContextMenu()
public UIContextButton setContextMenuWidth(float contextMenuWidth)
contextMenuWidth
- Width of context menupublic UIContextButton setContextActions(UIContextActions.Action[] contextActions)
contextActions
- Set of context actions shown when button is clickedpublic UIContextButton setLabel(String label)
label
- Labelpublic UIContextButton setDirection(UIContextButton.Direction direction)
direction
- Direction to openpublic void onDraw(UI ui, PGraphics pg)
UIObject
public void onMousePressed(MouseEvent mouseEvent, float mx, float my)
UIEventHandler
onMousePressed
in class UIEventHandler
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinatepublic void onMouseReleased(MouseEvent mouseEvent, float mx, float my)
UIEventHandler
onMouseReleased
in class UIEventHandler
mouseEvent
- Mouse eventmx
- x-coordinatemy
- y-coordinatepublic void onKeyPressed(KeyEvent keyEvent, char keyChar, int keyCode)
UIEventHandler
onKeyPressed
in class UIEventHandler
keyEvent
- Key eventkeyChar
- Key characterkeyCode
- Key code valueLX library by Mark C. Slee. © 2012-2020