public class Frame extends Container
| Modifier and Type | Class and Description |
|---|---|
static class |
Frame.DrawTime
guiSET can draw the GUI either before (
Frame.DrawTime.PRE, default) the Processing
sketchs draw() method or after (Frame.DrawTime.POST). |
static class |
Frame.RefreshMode |
Control.Constants, Control.ImageMode, Control.Predicate, Control.Predicate1<T>, Control.Predicate2<T,U>, Control.RenderingMethod, Control.Setter<T>| Modifier and Type | Field and Description |
|---|---|
static Frame.RefreshMode |
CONTINOUS
Draw frequency mode.
|
static Frame.DrawTime |
DRAW_POST
GUI Draw time Mode: Draw the GUI after the
PApplet.draw() happens.The draw time mode
needs to be specified at the beginning when Frame is created. |
static Frame.DrawTime |
DRAW_PRE
GUI Draw time Mode: Draw the GUI before the
PApplet.draw() happens. |
static int |
DROP_FILE |
static int |
DROP_STRING |
static Frame.RefreshMode |
EFFICIENT
Draw frequency mode.
|
static Frame.RefreshMode |
NO_LOOP
Most efficient mode.
|
FONT_SIZE, LINE_HEIGHT, TEXT_ALIGN, TEXT_ALIGN_Y, TEXT_COLORALL, ANCHOR_INACTIVE, AUTOSIZE_BOTH, AUTOSIZE_HEIGHT, AUTOSIZE_NONE, AUTOSIZE_WIDTH, BACKGROUND_COLOR, BACKGROUND_COLORS, BORDER, BORDER_COLOR, BORDER_RADIUS, BORDER_WIDTH, BUFFERED_RENDERING, COLORS, defaultRenderingMethod, FILL, FIT, FIT_INSIDE, FOREGROUND_COLOR, HOVER_COLOR, MARGIN, MARGIN_BOTTOM, MARGIN_LEFT, MARGIN_RIGHT, MARGIN_TOP, name, OPACITY, PADDING, PADDING_BOTTOM, PADDING_LEFT, PADDING_RIGHT, PADDING_TOP, PERCENTAGE_MODE, PIXEL_MODE, PRESSED_COLOR, SPACING, TEXT_PROPERTIES, UNBUFFERED_RENDERING| Constructor and Description |
|---|
Frame(PApplet pa)
It is necessary to pass the sketch object here.
|
Frame(PApplet pa,
Frame.DrawTime timeToDraw)
Specify the draw time mode with this constructor.
|
| Modifier and Type | Method and Description |
|---|---|
void |
addAutoAnchors(int... anchors)
Add an anchor (types are TOP, RIGHT, BOTTOM, LEFT).
|
boolean |
deregisterShortcut(Shortcut shortcut)
If the shortcut has been removed returns true.
|
static Frame |
getFrame()
Get the one and only Frame.
|
int |
getOffsetXToWindow()
Get x coordinate of left side relative to window.
|
int |
getOffsetYToWindow()
Get x coordinate of left side relative to window.
|
static PApplet |
getPApplet() |
Frame.RefreshMode |
getRefreshMode() |
boolean |
isAltDown()
Check if the ALT key is currently being hold down
|
boolean |
isControlDown()
Check if the CONTROL key is currently being hold down
|
boolean |
isMetaDown()
Check if the META key is currently being hold down
|
boolean |
isResizable()
Check if application has been set to resizable.
|
boolean |
isShiftDown()
Check if the SHIFT key is currently being hold down
|
boolean |
registerShortcut(Shortcut shortcut,
Control.Predicate callback)
Register a shortcut to the sketch and fire the given lambda callback when the combination is hit
on the keyboard.
|
boolean |
registerShortcut(Shortcut shortcut,
Control.Predicate callback,
boolean executeEvenIfFocusedElementOverridesNormalShortcuts)
Register a shortcut to the sketch and fire the given lambda callback when the combination is hit
on the keyboard.
|
boolean |
registerShortcut(Shortcut shortcut,
java.lang.String methodName)
Register a shortcut to the sketch and fire the given method when the combination is hit on the
keyboard.
|
boolean |
registerShortcut(Shortcut shortcut,
java.lang.String methodName,
java.lang.Object target) |
boolean |
registerShortcut(Shortcut shortcut,
java.lang.String methodName,
java.lang.Object target,
boolean executeEvenIfFocusedElementOverridesNormalShortcuts) |
void |
removeDropElementListener() |
void |
removeEnterWindowListener() |
void |
removeExitWindowListener() |
void |
removeExternalDropListener() |
void |
removeGuiInitializedListener() |
void |
removeKeyListener() |
void |
removeWindowFocusGainedListener() |
void |
removeWindowFocusLostListener() |
void |
removeWindowResizeListener() |
void |
setAnchor(int anchorType,
int value)
Set an anchor of type TOP BOTTOM, LEFT or RIGHT to a certain value.
|
void |
setDropElementListener(Control.Predicate lambda) |
void |
setDropElementListener(Control.Predicate2<Control,Control> lambda) |
void |
setDropElementListener(java.lang.String methodName) |
void |
setDropElementListener(java.lang.String methodName,
java.lang.Object target)
Internal drop listener for any element in the application.
|
void |
setEnterWindowListener(Control.Predicate lambda) |
void |
setEnterWindowListener(Control.Predicate1<MouseEvent> lambda) |
void |
setEnterWindowListener(java.lang.String methodName) |
void |
setEnterWindowListener(java.lang.String methodName,
java.lang.Object target)
Listen for the mouse entering the window.
|
void |
setExitWindowListener(Control.Predicate lambda) |
void |
setExitWindowListener(Control.Predicate1<MouseEvent> lambda) |
void |
setExitWindowListener(java.lang.String methodName) |
void |
setExitWindowListener(java.lang.String methodName,
java.lang.Object target)
Listen for the mouse exiting the window.
|
void |
setExternalDropListener(java.lang.String methodName) |
void |
setExternalDropListener(java.lang.String methodName,
java.lang.Object target)
External drop listener for data dropped to the application.
|
void |
setGuiInitializedListener(Control.Predicate lambda) |
void |
setGuiInitializedListener(java.lang.String methodName) |
void |
setGuiInitializedListener(java.lang.String methodName,
java.lang.Object target)
Called when GUI is initialized and draw() runs for the first time.
|
void |
setHeight(int height)
Set height of element.
|
void |
setIcon(PImage img)
Set application icon.
|
void |
setKeyListener(Control.Predicate lambda) |
void |
setKeyListener(Control.Predicate1<KeyEvent> lambda) |
void |
setKeyListener(java.lang.String methodName) |
void |
setKeyListener(java.lang.String methodName,
java.lang.Object target)
Set a key listener which fires on key press, type and release events.
|
void |
setLocation(int x,
int y)
Set application location on computer screen.
|
void |
setMaximumWindowSize(int maxWidth,
int maxHeight)
Set the maximum size of the application window.
|
void |
setMinimumWindowSize(int minWidth,
int minHeight)
Set the minimum size of the application window.
|
void |
setRefreshMode(Frame.RefreshMode mode)
|
void |
setResizable(boolean resizable)
Make Application user-resizable.
|
void |
setTitle(java.lang.String title)
Set application title.
|
void |
setWidth(int width)
Set width of element.
|
void |
setWindowFocusGainedListener(Control.Predicate lambda) |
void |
setWindowFocusGainedListener(java.lang.String methodName) |
void |
setWindowFocusGainedListener(java.lang.String methodName,
java.lang.Object target)
Fired when the window gained focus.
|
void |
setWindowFocusLostListener(Control.Predicate lambda) |
void |
setWindowFocusLostListener(java.lang.String methodName) |
void |
setWindowFocusLostListener(java.lang.String methodName,
java.lang.Object target)
Fired when the window lost focus.
|
void |
setWindowResizeListener(Control.Predicate lambda) |
void |
setWindowResizeListener(Control.Predicate1<MouseEvent> lambda) |
void |
setWindowResizeListener(java.lang.String methodName) |
void |
setWindowResizeListener(java.lang.String methodName,
java.lang.Object target)
Called when the application window is resized.
|
void |
setWindowSize(int width,
int height)
Set the size of the application window.
|
void |
setX(int x)
Set x-coordinate of element relative to parent.
|
void |
setY(int y)
Set y-coordinate of element relative to parent.
|
add, clear, fitContent, getItem, getItems, getNumItems, indexOf, insert, remove, remove, sortItems, traceAbsoluteCoordinates, traceRelativeCoordinatescopyStyle, getFont, getFontSize, getLineHeight, getText, getTextAlign, getTextAlignY, getTextColor, isBold, isItalic, isStrikethrough, isUnderlined, setBold, setFont, setFontSize, setForegroundColor, setItalic, setLineHeight, setLineHeightPercent, setStrikethrough, setText, setText, setTextAlign, setTextAlignY, setTextColor, setUnderlinedanimate, blur, copyStyle, doForAll, fillParent, fillParent, fillParent, fillParentHeight, fillParentHeight, fillParentWidth, fillParentWidth, focus, forceRepaint, getAnchorMode, getAnchorValue, getAvailableHeight, getAvailableWidth, getBackgroundColor, getBorderColor, getBorderRadius, getBorderWidth, getCursor, getForegroundColor, getHeight, getHoverColor, getImage, getMarginBottom, getMarginLeft, getMarginRight, getMarginTop, getMaxHeight, getMaxWidth, getMinHeight, getMinWidth, getOffsetXToParent, getOffsetYToParent, getOpacity, getPaddingBottom, getPaddingLeft, getPaddingRight, getPaddingTop, getParent, getPressedColor, getVersionString, getWidth, getX, getY, getZ, isEnabled, isFocusable, isFocused, isPropagationStopped, isVisible, noAutosize, relativeCoordsAreWithin, removeAnchor, removeBoxShadow, removeFocusListener, removeMouseListener, removeResizeListener, setAnchors, setAutosizing, setBackgroundColor, setBorder, setBorder, setBorderColor, setBorderRadius, setBorderWidth, setBoxShadow, setCursor, setEnabled, setFixedSize, setFocusListener, setFocusListener, setFocusListener, setFocusListener, setGradient, setHeight, setHoverColor, setImage, setImageMode, setMargin, setMargin, setMargin, setMarginBottom, setMarginLeft, setMarginRight, setMarginTop, setMaxHeight, setMaxWidth, setMinHeight, setMinWidth, setMouseListener, setMouseListener, setMouseListener, setMouseListener, setOpacity, setOpacity, setPadding, setPadding, setPadding, setPaddingBottom, setPaddingLeft, setPaddingRight, setPaddingTop, setPercentageAnchor, setPercentageAnchors, setPixelAnchor, setPixelAnchors, setPosition, setPressedColor, setResizeListener, setResizeListener, setResizeListener, setResizeListener, setSize, setVisibility, setVisible, setWidth, setZ, stopPropagation, unfocuspublic static final Frame.DrawTime DRAW_PRE
PApplet.draw() happens. Useful when the user
wants to image some own stuff upon the GUI. The draw time mode needs to be specified at the
beginning when Frame is created. This is the default mode.public static final Frame.DrawTime DRAW_POST
PApplet.draw() happens.The draw time mode
needs to be specified at the beginning when Frame is created. Everything that is drawn during
PApplet.draw() will be overwritten without ever being visible, except when Frame is
transparent.public static final Frame.RefreshMode CONTINOUS
public static final Frame.RefreshMode EFFICIENT
PApplet.draw() loop running to check for some events but only redraws if necessary.public static final Frame.RefreshMode NO_LOOP
PApplet.draw() loop is interrupted and only key and mouse events
are still received and can change the state of the GUI. Animation timing is not as good.public static final int DROP_STRING
public static final int DROP_FILE
public Frame(PApplet pa)
pa - pappletpublic Frame(PApplet pa, Frame.DrawTime timeToDraw)
pa - papplettimeToDraw - DRAW_PRE or DRAW_POSTpublic static Frame getFrame()
public static PApplet getPApplet()
public void setRefreshMode(Frame.RefreshMode mode)
EFFICIENT CONTINOUS NO_LOOP. It is no
recommended to change the mode very frequently (like every few frames) to NO_LOOP and
back to one of the others as thus might reduce performance.mode - accepts Frame.EFFICIENT, Frame.CONTINOUS, Frame.NO_LOOPpublic Frame.RefreshMode getRefreshMode()
public boolean registerShortcut(Shortcut shortcut, Control.Predicate callback)
shortcut - shortcut to registercallback - lambda callbackpublic boolean registerShortcut(Shortcut shortcut, Control.Predicate callback, boolean executeEvenIfFocusedElementOverridesNormalShortcuts)
shortcut - shortcut to registercallback - lambda callbackexecuteEvenIfFocusedElementOverridesNormalShortcuts - Should this shortcut even work when
i.e. a textbox has focus?public boolean registerShortcut(Shortcut shortcut, java.lang.String methodName)
shortcut - shortcut to registermethodName - method to execute when shortcut is pressed.public boolean registerShortcut(Shortcut shortcut, java.lang.String methodName, java.lang.Object target)
shortcut - shortcut to registermethodName - method to execute when shortcut is pressed.target - object that declares the callback method.version with custom target object.public boolean registerShortcut(Shortcut shortcut, java.lang.String methodName, java.lang.Object target, boolean executeEvenIfFocusedElementOverridesNormalShortcuts)
shortcut - shortcut to registermethodName - method to execute when shortcut is
pressed.target - object that declares the callback
method.executeEvenIfFocusedElementOverridesNormalShortcuts - Should this shortcut even work when a
textbox has focus?If strong is set to true then this shortcut will even work when a textbox has focus! Default
is false.public boolean deregisterShortcut(Shortcut shortcut)
shortcut - shortcut to deregisterpublic void setIcon(PImage img)
img - icon imagepublic void setTitle(java.lang.String title)
title - titlepublic void setResizable(boolean resizable)
resizable - resizablepublic boolean isResizable()
public void setLocation(int x,
int y)
x - in pixel from the lefty - in pixel from the toppublic void setWindowSize(int width,
int height)
width - width in pixelheight - height in pixelpublic void setMinimumWindowSize(int minWidth,
int minHeight)
minWidth - minimum widthminHeight - minimum heightpublic void setMaximumWindowSize(int maxWidth,
int maxHeight)
maxWidth - maximum widthmaxHeight - maximum heightpublic void setWidth(int width)
Controlpublic void setHeight(int height)
Controlpublic void setX(int x)
Controlpublic void setY(int y)
Controlpublic void addAutoAnchors(int... anchors)
ControlControl.PIXEL_MODE and not with Control.PERCENTAGE_MODE
(mode will be set to the Control.PIXEL_MODE if the latter is currently selected).
It is not possible to use this method if this element has not been added to a parent.addAutoAnchors in class Controlanchors - accepts TOP, RIGHT, LEFT or BOTTOM. Pass up to four anchor types (order doesn't
matter)public void setAnchor(int anchorType,
int value)
ControlControl.setPercentageAnchor(int, int) and Control.setPixelAnchor(int, int).public void setKeyListener(java.lang.String methodName,
java.lang.Object target)
KeyEventmethodName - method nametarget - objectpublic void setKeyListener(java.lang.String methodName)
public void setKeyListener(Control.Predicate lambda)
public void setKeyListener(Control.Predicate1<KeyEvent> lambda)
public void removeKeyListener()
public void setGuiInitializedListener(java.lang.String methodName,
java.lang.Object target)
methodName - method nametarget - objectpublic void setGuiInitializedListener(java.lang.String methodName)
public void setGuiInitializedListener(Control.Predicate lambda)
public void removeGuiInitializedListener()
public void setWindowResizeListener(java.lang.String methodName,
java.lang.Object target)
MouseEventmethodName - method nametarget - objectpublic void setWindowResizeListener(java.lang.String methodName)
public void setWindowResizeListener(Control.Predicate lambda)
public void setWindowResizeListener(Control.Predicate1<MouseEvent> lambda)
public void removeWindowResizeListener()
public void setEnterWindowListener(java.lang.String methodName,
java.lang.Object target)
MouseEventmethodName - method nametarget - objectpublic void setEnterWindowListener(java.lang.String methodName)
public void setEnterWindowListener(Control.Predicate lambda)
public void setEnterWindowListener(Control.Predicate1<MouseEvent> lambda)
public void removeEnterWindowListener()
public void setExitWindowListener(java.lang.String methodName,
java.lang.Object target)
MouseEventmethodName - method nametarget - objectpublic void setExitWindowListener(java.lang.String methodName)
public void setExitWindowListener(Control.Predicate lambda)
public void setExitWindowListener(Control.Predicate1<MouseEvent> lambda)
public void removeExitWindowListener()
public void setDropElementListener(java.lang.String methodName,
java.lang.Object target)
Control, ControlmethodName - method nametarget - objectpublic void setDropElementListener(java.lang.String methodName)
public void setDropElementListener(Control.Predicate lambda)
public void setDropElementListener(Control.Predicate2<Control,Control> lambda)
public void removeDropElementListener()
public void setWindowFocusGainedListener(java.lang.String methodName,
java.lang.Object target)
methodName - method nametarget - objectpublic void setWindowFocusGainedListener(java.lang.String methodName)
public void setWindowFocusGainedListener(Control.Predicate lambda)
public void removeWindowFocusGainedListener()
public void setWindowFocusLostListener(java.lang.String methodName,
java.lang.Object target)
methodName - method nametarget - objectpublic void setWindowFocusLostListener(java.lang.String methodName)
public void setWindowFocusLostListener(Control.Predicate lambda)
public void removeWindowFocusLostListener()
public void setExternalDropListener(java.lang.String methodName,
java.lang.Object target)
DROP_STRING or DROP_FILE)methodName - method nametarget - objectpublic void setExternalDropListener(java.lang.String methodName)
public void removeExternalDropListener()
public int getOffsetXToWindow()
ControlgetOffsetXToWindow in class Controlpublic int getOffsetYToWindow()
ControlgetOffsetYToWindow in class Controlpublic boolean isControlDown()
public boolean isShiftDown()
public boolean isAltDown()
public boolean isMetaDown()
Processing Library guiSET by Mc Zen. (c) 2021