public abstract class GComponent extends Object implements PConstants, GConstants, Comparable<Object>
Modifier and Type | Class and Description |
---|---|
static class |
GComponent.Z_Order
Comparator used for controlling the order components are drawn
|
Modifier and Type | Field and Description |
---|---|
int |
eventType |
static Font |
fGlobalFont |
static GCScheme |
globalColor |
static int |
globalColorScheme |
static PFont |
globalFont |
GCScheme |
localColor |
PFont |
localFont |
String |
tag
Simple tag that can be used by the user
|
int |
tagNo
Allows user to specify a number for this component
|
int |
z
Used to when components overlap
|
ADD, ALPHA, ALPHA_MASK, ALT, AMBIENT, ARC, ARGB, ARROW, BACKSPACE, BASELINE, BEVEL, BEZIER_VERTEX, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BREAK, BURN, CENTER, CHATTER, CLAMP, CLOSE, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CURVE_VERTEX, CUSTOM, DARKEST, DEG_TO_RAD, DELETE, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_2D, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_MASK, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_NATIVE_FONTS, DISABLE_OPENGL_ERRORS, DISABLE_STROKE_PERSPECTIVE, DISABLE_TEXTURE_CACHE, DISABLE_TEXTURE_MIPMAPS, DISABLE_TRANSFORM_CACHE, DODGE, DOWN, DXF, ELLIPSE, ENABLE_ACCURATE_2D, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_MASK, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_ERRORS, ENABLE_STROKE_PERSPECTIVE, ENABLE_TEXTURE_CACHE, ENABLE_TEXTURE_MIPMAPS, ENABLE_TRANSFORM_CACHE, ENTER, EPSILON, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, GIF, GRAY, GREEN_MASK, GROUP, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LANDSCAPE, LEFT, LIGHTEST, LINE, LINE_LOOP, LINE_STRIP, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MODELVIEW, MOVE, MULTIPLY, NORMAL, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, PORTRAIT, POSTERIZE, PROBLEM, PROJECT, PROJECTION, QUAD, QUAD_BEZIER_VERTEX, QUAD_STRIP, QUADS, QUARTER_PI, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPEAT, REPLACE, RETURN, RGB, RIGHT, ROUND, SCREEN, SHAPE, SHIFT, SOFT_LIGHT, SPHERE, SPOT, SQUARE, SUBTRACT, TAB, TARGA, TEXT, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, UP, VERTEX, WAIT, WHITESPACE, WINDOWS, X, Y, Z
ADD_DUPLICATE, BACKGROUND, CHANGED, CLICKED, CLOSE_WINDOW, COLLAPSED, CTRL_ANGULAR, CTRL_HORIZONTAL, CTRL_VERTICAL, DESELECTED, DISABLE_AUTO_DRAW, DRAGGED, ENTERED, EXCP_IN_HANDLER, EXIT_APP, EXPANDED, FAMILY, FOREGROUND, HUD_UNSUPPORTED, INVALID_STATUS, JUSTIFICATION, JUSTIFICATION_FULL, JUSTIFICATION_NONE, KEEP_OPEN, MISSING, NONEXISTANT, NOT_PEASYCAM, POSTURE, POSTURE_OBLIQUE, POSTURE_REGULAR, PRESSED, RELEASED, RUNTIME_ERROR, SCROLL_DOWN, SCROLL_LEFT, SCROLL_RIGHT, SCROLL_UP, SCROLLBAR_HORIZONTAL, SCROLLBAR_VERTICAL, SCROLLBARS_AUTOHIDE, SCROLLBARS_BOTH, SCROLLBARS_HORIZONTAL_ONLY, SCROLLBARS_NONE, SCROLLBARS_VERTICAL_ONLY, SELECTED, SET, SIZE, STRIKETHROUGH, STRIKETHROUGH_OFF, STRIKETHROUGH_ON, SUPERSCRIPT, SUPERSCRIPT_SUB, SUPERSCRIPT_SUPER, USER_COL_SCHEME, WEIGHT, WEIGHT_BOLD, WEIGHT_DEMIBOLD, WEIGHT_DEMILIGHT, WEIGHT_EXTRA_LIGHT, WEIGHT_EXTRABOLD, WEIGHT_HEAVY, WEIGHT_LIGHT, WEIGHT_MEDIUM, WEIGHT_REGULAR, WEIGHT_SEMIBOLD, WEIGHT_ULTRABOLD, WIDTH, WIDTH_CONDENSED, WIDTH_EXTENDED, WIDTH_REGULAR, WIDTH_SEMI_CONDENSED, WIDTH_SEMI_EXTENDED
Constructor and Description |
---|
GComponent(PApplet theApplet,
float p0,
float p1,
float p2,
float p3) |
GComponent(PApplet theApplet,
int x,
int y)
INTERNAL USE ONLY
This constructor MUST be called by all constructors
of any child class e.g.
|
Modifier and Type | Method and Description |
---|---|
boolean |
add(GComponent child)
Add a GUI component to this GComponent at the position specified by
component being added.
|
void |
addAbsoluteControl(GComponent c)
The control to be added has absolute screen coordinates.
|
void |
addCompoundControl(GComponent c,
float x,
float y,
float angle)
This will set the rotation of the control to angle overwriting
any previous rotation set.
|
void |
addEventHandler(Object obj,
String methodName)
Attempt to create the default event handler for the component class.
|
void |
addEventHandler(Object obj,
String methodName,
Class[] parameters)
Attempt to create the default event handler for the component class.
|
void |
addRelativeControl(GComponent c)
The control to be added has screen coordinates relative to this control
|
boolean |
addXXX(GComponent c) |
void |
calcAbsPosition(Point d)
This method will calculate the absolute top left position of this
component taking into account any ancestors.
|
void |
changeWindow(PApplet newWindowApp)
Called when we add a component to another window.
|
int |
compareTo(Object o) |
boolean |
contains(float px,
float py)
NOT REQD
Remove this method from the release version performs the same task as
calcTransformedOrigin(px,py) but also tests to see if it is over
the control.
|
static void |
ctrlMode(int mode)
Change the way position and size parameters are interpreted when a control is created.
|
void |
dispose()
Completely dispose of this component.
|
void |
draw()
Override in child classes
|
int |
getAlpha()
How transparent / opaque is this component
|
int |
getBorder()
Get the border width
|
static int |
getCtrlMode()
Get the control creation mode @see ctrlMode(int mode)
|
int |
getEventType()
This can be used to detect the type of event
|
static GComponent |
getFocusObject()
Get a the object (if any) that currently has focus
|
float |
getHeight() |
boolean |
getOpaque()
Find out if the component is opaque
|
PApplet |
getPApplet()
Get the PApplet object
|
GComponent |
getParent() |
StyledString |
getStyledText()
Get the StyledString used for display
|
String |
getText() |
AffineTransform |
getTransform(AffineTransform aff)
Get an affine transformation that is the compound of all
transformations including parents
|
float |
getWidth() |
float |
getX() |
float |
getY() |
boolean |
hasFocus()
Does this component have focus
|
boolean |
hasKeyFocus()
Does this component have key focus
|
boolean |
isEnabled()
Is this component enabled
|
boolean |
isOver(int ax,
int ay)
Determines whether the position ax, ay is over this component.
|
boolean |
isVisible() |
void |
keyPressed(KeyEvent event)
Override in child classes
|
void |
mouseEvent(MouseEvent event)
Override in child classes.
|
void |
pre()
Override in child classes
|
void |
remove(GComponent component)
Remove a GUI component from this component
|
void |
setAlpha(int alpha)
Controls the transparency of this component
0 = fully transparent
255 = fully opaque
|
void |
setBorder(int border)
The user can add a border by specifying it's thickness
a value of 0 means no border (this is the default)
|
void |
setColorScheme(int schemeNo)
Sets the local color scheme
|
void |
setEnabled(boolean enable)
Enable or disable the ability of the component to generate mouse events.
GTextField - it also controls key press events GPanel - controls whether the panel can be moved/collapsed/expanded |
void |
setFocus(boolean focus)
Determines whether this component is to have focus or not
|
void |
setFont(String fontname,
int fontsize)
Override in child classes
|
void |
setFontNew(Font font)
Set the global font to be used by all controls.
|
void |
setFontNew(PFont pfont)
Set the global font to be used by all controls.
|
void |
setHeight(int height) |
void |
setLocalColorScheme(int cs) |
void |
setOpaque(boolean opaque)
Determines wheher to show tha back color or not.
|
void |
setRotation(float rot) |
void |
setText(String text) |
void |
setText(String text,
int align) |
void |
setTextAlign(int align)
Set the text alignment inside the box.
|
void |
setTextNew(String text)
Set the text to be displayed.
|
void |
setTextNew(String text,
int wrapWidth) |
void |
setVisible(boolean visible) |
void |
setWidth(float width) |
void |
setX(int x)
Sets the x position of a component
|
void |
setXY(int x,
int y)
Sets the position of a component
|
void |
setY(int y)
Sets the x position of a component
|
String |
toString() |
public static GCScheme globalColor
public GCScheme localColor
public static int globalColorScheme
public static Font fGlobalFont
public static PFont globalFont
public PFont localFont
public int z
public String tag
public int tagNo
public int eventType
public GComponent(PApplet theApplet, int x, int y)
theApplet
- x
- y
- public GComponent(PApplet theApplet, float p0, float p1, float p2, float p3)
public static void ctrlMode(int mode)
PApplet.CORNER (x, y, w, h) PApplet.CORNERS (x0, y0, x1, y1) PApplet.CENTER (cx, cy, w, h)
mode
- illegal values are ignored leaving the mode unchangedpublic static int getCtrlMode()
public void setLocalColorScheme(int cs)
public void addAbsoluteControl(GComponent c)
c
- public void addRelativeControl(GComponent c)
c
- public void addCompoundControl(GComponent c, float x, float y, float angle)
c
- x
- y
- angle
- public boolean addXXX(GComponent c)
public void setRotation(float rot)
public AffineTransform getTransform(AffineTransform aff)
aff
- public boolean contains(float px, float py)
px
- py
- public void addEventHandler(Object obj, String methodName)
obj
- the object to handle the eventmethodName
- the method to execute in the object handler classpublic void addEventHandler(Object obj, String methodName, Class[] parameters)
obj
- the object to handle the eventmethodName
- the method to execute in the object handler classparameters
- the parameter classes.public PApplet getPApplet()
public void setFocus(boolean focus)
focus
- public boolean hasFocus()
public boolean hasKeyFocus()
public static GComponent getFocusObject()
public int getEventType()
public boolean add(GComponent child)
public void remove(GComponent component)
component
- public void pre()
public void draw()
public void mouseEvent(MouseEvent event)
public void keyPressed(KeyEvent event)
event
- public void dispose()
public void changeWindow(PApplet newWindowApp)
newWindowApp
- public boolean isOver(int ax, int ay)
ax
- mouse x positionay
- mouse y positionpublic void calcAbsPosition(Point d)
d
- public GComponent getParent()
public void setColorScheme(int schemeNo)
schemeNo
- public String getText()
public StyledString getStyledText()
public void setTextNew(String text)
text
- public void setTextNew(String text, int wrapWidth)
public void setText(String text)
text
- use this function to set the text so that the
text length is calculatedpublic void setText(String text, int align)
text
- the text to set with alignmentpublic void setTextAlign(int align)
align
- the alignment flagpublic void setFont(String fontname, int fontsize)
fontname
- fontsize
- public void setFontNew(Font font)
font
- the java.awt.Font to usepublic void setFontNew(PFont pfont)
pfont
- the Processing font to usepublic void setXY(int x, int y)
x
- y
- public void setX(int x)
x
- public void setY(int y)
y
- public float getX()
public float getY()
public float getWidth()
public void setWidth(float width)
width
- the width to setpublic float getHeight()
public void setHeight(int height)
height
- the height to setpublic boolean isVisible()
public void setEnabled(boolean enable)
enable
- true to enable else falsepublic boolean isEnabled()
public void setVisible(boolean visible)
visible
- the visibility to setpublic void setBorder(int border)
border
- width in pixelspublic int getBorder()
public void setOpaque(boolean opaque)
opaque
- public boolean getOpaque()
public void setAlpha(int alpha)
alpha
- public int getAlpha()
public int compareTo(Object o)
compareTo
in interface Comparable<Object>
Processing library guicomponents by Peter Lager. (C) 2012