|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectrita.RiObject
rita.support.gui.RiGUIWidget
rita.RiTextField
public class RiTextField
A simple text widget to handle user keyboard input
To capture the input from a RiTextField, you need to
add the
method 'void onTextInput(String input)' to your
sketch as follows:
// called when 'enter' is typed in the text-field
void onRiTaEvent(RiTaEvent re)
{
String input = (String)re.getData();
// do something with the text that was entered
System.out.println("Text entered: "+input);
...
}
Note: if you wish to change the key that triggers when text is captured, you can call textField.resetEnterCode(int codeForKeyToUseAsEnter);
| Field Summary |
|---|
| Fields inherited from interface processing.core.PConstants |
|---|
A, AB, ADD, AG, ALPHA, ALPHA_MASK, ALT, AMBIENT, AR, ARC, ARGB, ARROW, B, BACKSPACE, BASELINE, BEEN_LIT, BEVEL, BLEND, BLUE_MASK, BLUR, BOTTOM, BOX, BURN, CENTER, CENTER_DIAMETER, CENTER_RADIUS, CHATTER, CLOSE, CMYK, CODED, COMPLAINT, CONTROL, CORNER, CORNERS, CROSS, CUSTOM, DA, DARKEST, DB, DEG_TO_RAD, DELETE, DG, DIAMETER, DIFFERENCE, DILATE, DIRECTIONAL, DISABLE_ACCURATE_TEXTURES, DISABLE_DEPTH_SORT, DISABLE_DEPTH_TEST, DISABLE_OPENGL_2X_SMOOTH, DISABLE_OPENGL_ERROR_REPORT, DODGE, DOWN, DR, DXF, EB, EDGE, EG, ELLIPSE, ENABLE_ACCURATE_TEXTURES, ENABLE_DEPTH_SORT, ENABLE_DEPTH_TEST, ENABLE_NATIVE_FONTS, ENABLE_OPENGL_2X_SMOOTH, ENABLE_OPENGL_4X_SMOOTH, ENABLE_OPENGL_ERROR_REPORT, ENTER, EPSILON, ER, ERODE, ERROR_BACKGROUND_IMAGE_FORMAT, ERROR_BACKGROUND_IMAGE_SIZE, ERROR_PUSHMATRIX_OVERFLOW, ERROR_PUSHMATRIX_UNDERFLOW, ERROR_TEXTFONT_NULL_PFONT, ESC, EXCLUSION, G, GIF, GRAY, GREEN_MASK, HALF_PI, HAND, HARD_LIGHT, HINT_COUNT, HSB, IMAGE, INVERT, JAVA2D, JPEG, LEFT, LIGHTEST, LINE, LINES, LINUX, MACOSX, MAX_FLOAT, MAX_INT, MIN_FLOAT, MIN_INT, MITER, MODEL, MULTIPLY, NORMAL, NORMALIZED, NX, NY, NZ, OPAQUE, OPEN, OPENGL, ORTHOGRAPHIC, OTHER, OVERLAY, P2D, P3D, PATH, PDF, PERSPECTIVE, PI, platformNames, POINT, POINTS, POLYGON, POSTERIZE, PROBLEM, PROJECT, QUAD, QUAD_STRIP, QUADS, QUARTER_PI, R, RAD_TO_DEG, RADIUS, RECT, RED_MASK, REPLACE, RETURN, RGB, RIGHT, ROUND, SA, SB, SCREEN, SG, SHAPE, SHIFT, SHINE, SOFT_LIGHT, SPB, SPG, SPHERE, SPOT, SPR, SQUARE, SR, SUBTRACT, SW, TAB, TARGA, THIRD_PI, THRESHOLD, TIFF, TOP, TRIANGLE, TRIANGLE_FAN, TRIANGLE_STRIP, TRIANGLES, TWO_PI, TX, TY, TZ, U, UP, V, VERTEX_FIELD_COUNT, VW, VX, VY, VZ, WAIT, WHITESPACE, WINDOWS, X, Y, Z |
| Constructor Summary | |
|---|---|
RiTextField(processing.core.PApplet pApplet)
|
|
RiTextField(processing.core.PApplet pApplet,
int x,
int y)
|
|
RiTextField(processing.core.PApplet pApplet,
int x,
int y,
int width)
|
|
RiTextField(processing.core.PApplet pApplet,
int x,
int y,
int width,
int height)
|
|
RiTextField(processing.core.PApplet pApplet,
int x,
int y,
int width,
int height,
float fontSize)
|
|
RiTextField(processing.core.PApplet pApplet,
int x,
int y,
int width,
int height,
float fontSize,
java.lang.String initialText)
|
|
| Method Summary | |
|---|---|
void |
actionPerformed(RiGUIEvent e)
|
void |
clear()
Clears any text in the text field |
void |
draw()
|
int |
getEnterCode()
Returns the key that currently triggers 'enter' in the text field; the default value is 10, for the enter key on most keyboards. |
float |
getTextOffsetY()
Returns the current Y-offset for typed text |
java.lang.String |
getValue()
|
void |
initWithParent()
|
boolean |
isVisible()
Returns true if the object is visible |
void |
keyEvent(java.awt.event.KeyEvent e)
|
void |
mouseEvent(java.awt.event.MouseEvent e)
|
void |
resetEnterCode(int keyCodeForEnter)
Resets the key that triggers 'enter' in the text field; the default value is 10, for the enter key on most keyboards. |
void |
setActiveColor(float gray)
|
void |
setActiveColor(float gray,
float alpha)
|
void |
setActiveColor(float r,
float g,
float b)
|
void |
setActiveColor(float r,
float g,
float b,
float alpha)
Set the active color for this object |
void |
setBgColor(float gray)
|
void |
setBgColor(float gray,
float alpha)
|
void |
setBgColor(float r,
float g,
float b)
|
void |
setBgColor(float r,
float g,
float b,
float alpha)
Set the bg color for this object |
void |
setColor(float gray)
|
void |
setColor(float gray,
float alpha)
|
void |
setColor(float r,
float g,
float b)
|
void |
setColor(float r,
float g,
float b,
float a)
|
void |
setFgColor(float gray)
|
void |
setFgColor(float gray,
float alpha)
|
void |
setFgColor(float r,
float g,
float b)
|
void |
setFgColor(float r,
float g,
float b,
float alpha)
Set the fg color for this object |
void |
setText(java.lang.String text)
Sets the text showing in the text field |
void |
setTextOffsetY(float textOffset)
Sets the Y-offset for typed text |
void |
setValue(java.lang.String newValue)
|
void |
setVisible(boolean visible)
Sets whether the text-field should be drawn (default=true) |
| Methods inherited from class rita.support.gui.RiGUIWidget |
|---|
canReceiveFocus, fireEventNotification, getController, getHeight, getIndex, getLabel, getWidth, getX, getY, isMouseOver, setController, setHeight, setIndex, setLabel, setLookAndFeel, setPosition, setSize, setWidth, setX, setY, update |
| Methods inherited from class rita.RiObject |
|---|
dispose, getId, getPApplet, nextId |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public RiTextField(processing.core.PApplet pApplet)
public RiTextField(processing.core.PApplet pApplet,
int x,
int y)
public RiTextField(processing.core.PApplet pApplet,
int x,
int y,
int width)
public RiTextField(processing.core.PApplet pApplet,
int x,
int y,
int width,
int height)
public RiTextField(processing.core.PApplet pApplet,
int x,
int y,
int width,
int height,
float fontSize)
public RiTextField(processing.core.PApplet pApplet,
int x,
int y,
int width,
int height,
float fontSize,
java.lang.String initialText)
| Method Detail |
|---|
public void setText(java.lang.String text)
public void clear()
public void initWithParent()
initWithParent in class RiGUIWidgetpublic void setValue(java.lang.String newValue)
public java.lang.String getValue()
public void mouseEvent(java.awt.event.MouseEvent e)
mouseEvent in class RiGUIWidgetpublic void resetEnterCode(int keyCodeForEnter)
public int getEnterCode()
public void keyEvent(java.awt.event.KeyEvent e)
keyEvent in class RiGUIWidgetpublic void draw()
draw in interface TextFielddraw in class RiGUIWidgetpublic void actionPerformed(RiGUIEvent e)
actionPerformed in class RiGUIWidget
public void setActiveColor(float r,
float g,
float b,
float alpha)
TextField
setActiveColor in interface TextFieldr - red component (0-255)g - green component (0-255)b - blue component (0-255)alpha - transparency (0-255)public void setActiveColor(float gray)
setActiveColor in interface TextField
public void setActiveColor(float gray,
float alpha)
setActiveColor in interface TextField
public void setActiveColor(float r,
float g,
float b)
setActiveColor in interface TextField
public void setBgColor(float r,
float g,
float b,
float alpha)
TextField
setBgColor in interface TextFieldr - red component (0-255)g - green component (0-255)b - blue component (0-255)alpha - transparency (0-255)
public void setBgColor(float gray,
float alpha)
setBgColor in interface TextField
public void setBgColor(float r,
float g,
float b)
setBgColor in interface TextFieldpublic void setBgColor(float gray)
setBgColor in interface TextField
public void setColor(float r,
float g,
float b,
float a)
public void setColor(float gray)
public void setColor(float gray,
float alpha)
public void setColor(float r,
float g,
float b)
public void setFgColor(float r,
float g,
float b,
float alpha)
TextField
setFgColor in interface TextFieldr - red component (0-255)g - green component (0-255)b - blue component (0-255)alpha - transparency (0-255)public void setFgColor(float gray)
setFgColor in interface TextField
public void setFgColor(float gray,
float alpha)
setFgColor in interface TextField
public void setFgColor(float r,
float g,
float b)
setFgColor in interface TextFieldpublic void setVisible(boolean visible)
setVisible in interface TextFieldpublic boolean isVisible()
public float getTextOffsetY()
public void setTextOffsetY(float textOffset)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||