G4P (GUI for Processing) 4.3.11
A set of GUI controls for your Processing sketch.
|
Classes | |
class | G4Pstyle |
Static Public Member Functions | |
static GControlMode | getCtrlMode () |
static int | getCursor () |
static int | getCursorOff () |
static GWindow[] | getOpenWindowsAsArray () |
static ArrayList< GWindow > | getOpenWindowsAsList (ArrayList< GWindow > list) |
static String | getPrettyVersion () |
static String | getVersion () |
static boolean | isWindowOpen (GWindow window) |
static void | messagesEnabled (boolean enable) |
static void | mouseWheelScrollbarDirection (int dir) |
static void | mouseWheelSliderDirection (int dir) |
static void | mouseWheelSpinnerDirection (int dir) |
static void | registerSketch (PApplet app) |
static int | selectColor () |
static int | selectColor (Color color) |
static int | selectColor (int color) |
static int | selectColor (int red, int green, int blue) |
static String | selectFolder (String prompt) |
static String | selectInput (String prompt) |
static String | selectInput (String prompt, String startFolder) |
static String | selectInput (String prompt, String types, String typeDesc) |
static String | selectInput (String prompt, String types, String typeDesc, String startFolder) |
static int | selectOption (PApplet owner, String message, String title, int messageType, int optionType) |
static String | selectOutput (String prompt) |
static String | selectOutput (String prompt, String startFolder) |
static String | selectOutput (String prompt, String types, String typeDesc) |
static String | selectOutput (String prompt, String types, String typeDesc, String startFolder) |
static void | setCtrlMode (GControlMode mode) |
static void | setCursor (int cursorOff) |
static void | setCursorOff (int cursorOff) |
static void | setDisplayFont (String familyName, int style, int size) |
static void | setGlobalAlpha (int alpha) |
static void | setGlobalColorScheme (int cs) |
static void | setInputFont (String familyName, int style, int size) |
static void | setMouseOverEnabled (boolean enable) |
static void | setSliderFont (String familyName, int style, int size) |
static void | setTipFont (String familyName, int style, int size) |
static void | setTipShowTime (long msecs) |
static void | setWindowAlpha (PApplet app, int alpha) |
static void | setWindowColorScheme (PApplet app, int cs) |
static void | showMessage (PApplet owner, String message, String title, int messageType) |
static void | usePre35Fonts () |
Static Protected Member Functions | |
static int | selectColorImpl (Color color) |
Additional Inherited Members | |
Public Attributes inherited from g4p_controls.GConstants | |
int | ALPHA_BLOCK = 128 |
int | ALPHA_PICK = 48 |
TextAttribute | BACKGROUND = TextAttribute.BACKGROUND |
int | BLUE_SCHEME = 6 |
int | BOLD = Font.BOLD |
int | CANCEL = JOptionPane.CANCEL_OPTION |
int | CLOSE_WINDOW = 0x00000f02 |
int | CLOSED = JOptionPane.CLOSED_OPTION |
int | CTRL_ANGULAR = 0x00000501 |
int | CTRL_HORIZONTAL = 0x00000502 |
int | CTRL_VERTICAL = 0x00000503 |
int | CYAN_SCHEME = 5 |
int | DECIMAL = 1 |
char | END = java.awt.event.KeyEvent.VK_END |
int | ERROR_MESSAGE = JOptionPane.ERROR_MESSAGE |
int | EXIT_APP = 0x00000f01 |
int | EXPONENT = 2 |
TextAttribute | FAMILY = TextAttribute.FAMILY |
TextAttribute | FOREGROUND = TextAttribute.FOREGROUND |
int | FORWARD = 1 |
int | GOLD_SCHEME = 7 |
int | GREEN_SCHEME = 1 |
int | HIDE_WINDOW = 0x00000f04 |
char | HOME = java.awt.event.KeyEvent.VK_HOME |
int | INFO_MESSAGE = JOptionPane.INFORMATION_MESSAGE |
int | INTEGER = 0 |
int | ITALIC = Font.ITALIC |
int | KEEP_OPEN = 0x00000f03 |
int | NO = JOptionPane.NO_OPTION |
int | OK = JOptionPane.OK_OPTION |
int | OK_CANCEL = JOptionPane.OK_CANCEL_OPTION |
int | ORANGE_SCHEME = 4 |
int | ORIENT_LEFT = -1 |
int | ORIENT_RIGHT = 1 |
int | ORIENT_TRACK = 0 |
int | PLAIN = Font.PLAIN |
int | PLAIN_MESSAGE = JOptionPane.PLAIN_MESSAGE |
TextAttribute | POSTURE = TextAttribute.POSTURE |
Float | POSTURE_OBLIQUE = new Float(0.20f) |
Float | POSTURE_REGULAR = new Float(0.0f) |
int | PURPLE_SCHEME = 3 |
int | QUERY_MESSAGE = JOptionPane.QUESTION_MESSAGE |
int | RED_SCHEME = 0 |
int | REVERSE = -1 |
int | SCHEME_10 = 10 |
int | SCHEME_11 = 11 |
int | SCHEME_12 = 12 |
int | SCHEME_13 = 13 |
int | SCHEME_14 = 14 |
int | SCHEME_15 = 15 |
int | SCHEME_8 = 8 |
int | SCHEME_9 = 9 |
int | SCROLLBARS_AUTOHIDE = 0x1000 |
int | SCROLLBARS_BOTH = 0x0003 |
int | SCROLLBARS_HORIZONTAL_ONLY = 0x0002 |
int | SCROLLBARS_NONE = 0x0000 |
int | SCROLLBARS_VERTICAL_ONLY = 0x0001 |
TextAttribute | SIZE = TextAttribute.SIZE |
TextAttribute | STRIKETHROUGH = TextAttribute.STRIKETHROUGH |
Boolean | STRIKETHROUGH_OFF = new Boolean(false) |
Boolean | STRIKETHROUGH_ON = new Boolean(true) |
TextAttribute | SUPERSCRIPT = TextAttribute.SUPERSCRIPT |
Integer | SUPERSCRIPT_OFF = new Integer(0) |
Integer | SUPERSCRIPT_SUB = new Integer(-1) |
Integer | SUPERSCRIPT_SUPER = new Integer(1) |
int | UNDEFINED = Integer.MAX_VALUE |
TextAttribute | UNDERLINE = TextAttribute.UNDERLINE |
int | UNDERLINE_OFF = Integer.valueOf(-1) |
int | UNDERLINE_ON = TextAttribute.UNDERLINE_ON |
int | USER_COL_SCHEME = 0x00010102 |
int | WARN_MESSAGE = JOptionPane.WARNING_MESSAGE |
TextAttribute | WEIGHT = TextAttribute.WEIGHT |
Float | WEIGHT_BOLD = new Float(2.0f) |
Float | WEIGHT_DEMIBOLD = new Float(1.75f) |
Float | WEIGHT_DEMILIGHT = new Float(0.875f) |
Float | WEIGHT_EXTRA_LIGHT = new Float(0.5f) |
Float | WEIGHT_EXTRABOLD = new Float(2.5f) |
Float | WEIGHT_HEAVY = new Float(2.25f) |
Float | WEIGHT_LIGHT = new Float(0.75f) |
Float | WEIGHT_MEDIUM = new Float(1.5f) |
Float | WEIGHT_REGULAR = new Float(1.0f) |
Float | WEIGHT_SEMIBOLD = new Float(1.25f) |
Float | WEIGHT_ULTRABOLD = new Float(2.75f) |
TextAttribute | WIDTH = TextAttribute.WIDTH |
Float | WIDTH_CONDENSED = new Float(0.75f) |
Float | WIDTH_EXTENDED = new Float(1.5f) |
Float | WIDTH_REGULAR = new Float(1.0f) |
Float | WIDTH_SEMI_CONDENSED = new Float(0.875f) |
Float | WIDTH_SEMI_EXTENDED = new Float(1.25f) |
int | X4 = 1 |
int | X8 = 2 |
int | YELLOW_SCHEME = 2 |
int | YES = JOptionPane.YES_OPTION |
int | YES_NO = JOptionPane.YES_NO_OPTION |
int | YES_NO_CANCEL = JOptionPane.YES_NO_CANCEL_OPTION |
The core class for the global manipulation and execution of G4P.
All the methods and constants are static so to call a method or reference a constant prefix it's name with 'G4P.' for example
G4P.method_name(parameters); G4P.name_of_constant;
Please note that the methods
selectColor(...) selectFolder(...) selectInput(...) selectOutput(...)
are provided modal alternatives to those provided in Processing 3 and only work in JAVA2D mode.
They are provided as-is and have not been tested on all platforms. If they don't work for you then use those provided by Processing.
|
static |
Get the control creation mode
|
static |
Get the cursor shape used when the mouse is not over a G4P control'
|
static |
|
static |
Get an array of GWindow objects even if minimised or invisible.
This method never returns null, if there are no open windows the array will be of length zero.
|
static |
Get a list of all open GWindow objects even if minimised or invisible.
If an ArrayList is provided then its contents are cleared before adding references to all open GWindow objects. If an ArrayList is not provided then a new ArrayList will be created.
This method never returns null, if there are no open windows the list will be of size zero.
list | an optional ArrayList to use. In null will create a new ArrayList. |
|
static |
|
static |
|
static |
Use this to check whether a GWindow window is still open (as far as G4P is concerned).
window | the window we are interested in |
|
static |
G4P has a range of support messages eg
if you create a GUI component without an event handler or,
a slider where the visible size of the slider is less than the difference between min and max values.
This method allows the user to enable (default) or disable this option. If disable then it should be called before any GUI components are created.
If you are adding your own event handlers then I suggest that you disable messages.
enable | whether to enable messages or not |
|
static |
Determines how the direction of the mouse wheel rotation is interpreted for sliders. This value applies to all sliders.
The default value is FORWARD
dir | FORWARD or REVERSE, illegal values are ignored |
|
static |
Determines how the direction of the mouse wheel rotation is interpreted for sliders and knobs. This value applies to all sliders and knobs.
The default value is FORWARD
dir | FORWARD or REVERSE, illegal values are ignored |
|
static |
Determines how the direction of the mouse wheel rotation is interpreted for spinners. This value applies to all spinners.
The default value is FORWARD
dir | FORWARD or REVERSE, illegal values are ignored |
|
static |
Used to register the main sketch window with G4P. This is ignored if any G4P controls or windows have already been created because the act of creating a control will do this for you.
Some libraries such as PeasyCam change the transformation matrix when initiated. In which case either a G4P control should be created or this method called before creating a PeasyCam object.
app | the main sketch PApplet usually 'this' |
|
static |
This will open a version of the Java Swing color chooser dialog. The dialog's UI is dependent on the OS and JVM implementation running.
If you click on Cancel then it returns the last color previously selected.
|
static |
This will open a version of the Java Swing color chooser dialog. The dialog's UI is dependent on the OS and JVM implementation running.
If you click on Cancel then it returns the last color previously selected.
color | the color to start the dialog |
|
static |
This will open a version of the Java Swing color chooser dialog. The dialog's UI is dependent on the OS and JVM implementation running.
If you click on Cancel then it returns the last color previously selected.
color | the color to start the dialog. RGB color |
|
static |
This will open a version of the Java Swing color chooser dialog. The dialog's UI is dependent on the OS and JVM implementation running.
If you click on Cancel then it returns the last color previously selected.
red | red channel value (0-255) |
green | green channel value (0-255) |
blue | red channel value (0-255) |
|
staticprotected |
This will open a version of the Java Swing color chooser dialog. The dialog's UI is dependent on the OS and JVM implementation running.
If you click on Cancel then it returns the last color previously selected.
|
static |
Select a folder from the local file system.
prompt | the frame text for the chooser |
|
static |
Select a file for input from the local file system.
prompt | the frame text for the chooser |
|
static |
Select a file for input from the local file system.
prompt | the frame text for the chooser |
startFolder | the location to start the dialog box |
|
static |
Select a file for input from the local file system.
This version allows the dialog window to filter the output based on file extensions. This is not available on all platforms, if not then it is ignored.
It is definitely available on Linux systems because it uses the standard Swing JFileFinder component.
prompt | the frame text for the chooser |
types | a comma separated list of file extensions e.g. "png,gif,jpg,jpeg" |
typeDesc | simple textual description of the file types e.g. "Image files" |
|
static |
Select a file for input from the local file system.
This version allows the dialog window to filter the output based on file extensions. This is not available on all platforms, if not then it is ignored.
It is definitely available on Linux systems because it uses the standard Swing JFileFinder component.
prompt | the frame text for the chooser |
types | a comma separated list of file extensions e.g. "png,gif,jpg,jpeg" |
typeDesc | simple textual description of the file types e.g. "Image files" |
startFolder | the folder where the dialog starts (uses default if null or not a folder) |
|
static |
Display a simple message dialog window.
The actual UI will depend on the platform your application is running on.
The message type should be one of the following
G4P.PLAIN_MESSAGE, G4P.ERROR_MESSAGE, G4P.INFO_MESSAGE, G4P.WARN_MESSAGE, G4P.QUERY_MESSAGE
The option type should be one of the following
G4P.YES_NO, G4P.YES_NO_CANCEL, G4P.OK_CANCEL
This method returns a value to indicate which button was clicked. It will be one of the following
G4P.OK, G4P.YES, G4P.NO, G4P.CANCEL, G4P.CLOSED
Some comments on the returned value:
owner | the control responsible for this dialog. |
message | the text to be displayed in the main area of the dialog |
title | the text to appear in the dialog's title bar. |
messageType | the message type |
optionType | an integer designating the options available on the dialog DEFAULT_OPTION , YES_NO_OPTION , YES_NO_CANCEL_OPTION , or OK_CANCEL_OPTION |
|
static |
Select a file for output from the local file system.
prompt | the frame text for the chooser |
|
static |
Select a file for output from the local file system.
prompt | the frame text for the chooser |
startFolder | the folder where the dialog starts (uses default if null or not a folder) |
|
static |
Select a file for output from the local file system.
This version allows the dialog window to filter the output based on file extensions. This is not available on all platforms, if not then it is ignored.
It is definitely available on Linux systems because it uses the standard swing JFileFinder component.
prompt | the frame text for the chooser |
types | a comma separated list of file extensions e.g. "png,jpf,tiff" |
typeDesc | simple textual description of the file types e.g. "Image files" |
|
static |
Select a file for output from the local file system.
This version allows the dialog window to filter the output based on file extensions. This is not available on all platforms, if not then it is ignored.
It is definitely available on Linux systems because it uses the standard swing JFileFinder component.
prompt | the frame text for the chooser |
types | a comma separated list of file extensions e.g. "png,jpf,tiff" |
typeDesc | simple textual description of the file types e.g. "Image files" |
startFolder | the folder where the dialog starts (uses default if null or not a folder) |
|
static |
Change the way position and size parameters are interpreted when a control is created. or added to another control e.g. GPanel.
There are 3 modes.
GCtrlMode.CORNER(x, y, w, h) < br > GCtrlMode.CORNERS(x0, y0, x1, y1) < br > GCtrlMode.CENTER(cx, cy, w, h)
mode | illegal values are ignored leaving the mode unchanged |
|
static |
Set the cursor shape to be used when the mouse is not over a G4P control for the entire application including secondary windows.
cursorOff | the cursor shape. |
|
static |
cursorOff | the cursor shape. |
|
static |
Set the display font to be used with Buttons, labels, droplists panels etc. It only effects controls created after this method is called.
If it can't find the font on your system it will use [Arial, PLAIN, 12]
familyName | font family name e.g. "Arial", "Trebuchet MS", "Tahoma", "Helvetica", "Verdana" |
style | some combination of G4P.PLAIN, G4P.BOLD and G4P.ITALIC |
size | the font size (constrained to >= 6 point) |
|
static |
Set the transparency of all controls. If the alpha level for a control falls below G4P.ALPHA_BLOCK then it will no longer respond to mouse and keyboard events.
alpha | value in the range 0 (transparent) to 255 (opaque) |
|
static |
Set the global colour scheme. This will change the local colour scheme for every control.
cs | colour scheme to use (0-15) |
|
static |
Set the text font to be used for keyboard input into GTexField, GTextArea and GPassword controls. It only effects input controls created after this method is called.
If it can't find the font on your system it will use [Arial, PLAIN, 12]
familyName | font family name e.g. "Arial", "Trebuchet MS", "Tahoma", "Helvetica", "Verdana" |
style | some combination of G4P.PLAIN, G4P.BOLD and G4P.ITALIC |
size | the font size (constrained to >= 6 point) |
|
static |
Enables or disables cursor over component change.
Calls to this method are ignored if no G4P controls have been created.
enable | true to enable cursor change over components. |
|
static |
Set the font to be used with sliders. It only effects sliders created after this method is called.
If it can't find the font on your system it will use [Arial, BOLD, 11]
familyName | font family name e.g. "Arial", "Trebuchet MS", "Tahoma", "Helvetica", "Verdana" |
style | some combination of G4P.PLAIN, G4P.BOLD and G4P.ITALIC |
size | the font size (constrained to >= 6 point) |
|
static |
Set the font to be used with tool tips. It only effects tool tips created after this method is called.
If it can't find the font on your system it will use [Arial, PLAIN, 11]
familyName | font family name e.g. "Arial", "Trebuchet MS", "Tahoma", "Helvetica", "Verdana" |
style | some combination of G4P.PLAIN, G4P.BOLD and G4P.ITALIC |
size | the font size (constrained to >= 6 point) |
|
static |
Sets the maximum time for tool tips to remain visible. It only affects tool tips created after this method is called.
msecs | maximum length of time to show tool tips. |
|
static |
Set the transparency level for all controls drawn by the given PApplet. If the alpha level for a control falls below G4P.ALPHA_BLOCK then it will no longer respond to mouse and keyboard events.
app | the main sketch window or GWindow instance |
alpha | value in the range 0 (transparent) to 255 (opaque) |
|
static |
Set the colour scheme for all the controls drawn by the given PApplet. This will override any previous colour scheme for these controls.
app | either the main sketch PApplet or GWindo |
cs | colour scheme number |
|
static |
Display a simple message dialog window.
The actual UI will depend on the platform your application is running on.
The message type should be one of the following
G4P.PLAIN_MESSAGE, G4P.ERROR_MESSAGE, G4P.INFO_MESSAGE, G4P.WARN_MESSAGE, G4P.QUERY_MESSAGE
owner | the control responsible for this dialog. |
message | the text to be displayed in the main area of the dialog |
title | the text to appear in the dialog's title bar. |
messageType | the message type |
|
static |
Versions of G4P prior to 3.5 used logical fonts for the controls. So if you have old sketches then the text may look different with this and later versions of G4P.
If this is causing a problem then call this method before creating any controls.