rita
Class RiTextField

java.lang.Object
  extended by rita.RiObject
      extended by rita.support.gui.RiGUIWidget
          extended by rita.RiTextField
All Implemented Interfaces:
processing.core.PConstants, TextField, RiConstants

public class RiTextField
extends RiGUIWidget
implements TextField

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 rita.support.RiConstants
BEHAVIOR_COMPLETED, BOUNDING_BOX_ALPHA, BRILL_POS_TAGGER, EASE_IN, EASE_IN_CUBIC, EASE_IN_EXPO, EASE_IN_OUT, EASE_IN_OUT_CUBIC, EASE_IN_OUT_EXPO, EASE_IN_OUT_QUARTIC, EASE_IN_OUT_SINE, EASE_IN_QUARTIC, EASE_IN_SINE, EASE_OUT, EASE_OUT_CUBIC, EASE_OUT_EXPO, EASE_OUT_QUARTIC, EASE_OUT_SINE, ESS, FADE_COLOR, FADE_IN, FADE_OUT, FADE_TO_TEXT, FIRST_PERSON, FUTURE_TENSE, ID, LERP, LINEAR, MAXENT_POS_TAGGER, MINIM, MOVE, MUTABLE, PAST_TENSE, PHONEME_BOUNDARY, PHONEMES, PLING_STEMMER, PLURAL, PORTER_STEMMER, POS, PRESENT_TENSE, SCALE_TO, SECOND_PERSON, SENTENCE_BOUNDARY, SINGULAR, SONIA, SPEECH_COMPLETED, STRESSES, SYLLABLE_BOUNDARY, SYLLABLES, TEXT, TEXT_ENTERED, THIRD_PERSON, TIMER, TIMER_COMPLETED, TIMER_TICK, TOKENS, UNKNOWN, WORD_BOUNDARY
 
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

RiTextField

public RiTextField(processing.core.PApplet pApplet)

RiTextField

public RiTextField(processing.core.PApplet pApplet,
                   int x,
                   int y)

RiTextField

public RiTextField(processing.core.PApplet pApplet,
                   int x,
                   int y,
                   int width)

RiTextField

public RiTextField(processing.core.PApplet pApplet,
                   int x,
                   int y,
                   int width,
                   int height)

RiTextField

public RiTextField(processing.core.PApplet pApplet,
                   int x,
                   int y,
                   int width,
                   int height,
                   float fontSize)

RiTextField

public RiTextField(processing.core.PApplet pApplet,
                   int x,
                   int y,
                   int width,
                   int height,
                   float fontSize,
                   java.lang.String initialText)
Method Detail

setText

public void setText(java.lang.String text)
Sets the text showing in the text field


clear

public void clear()
Clears any text in the text field


initWithParent

public void initWithParent()
Overrides:
initWithParent in class RiGUIWidget
Invisible:

setValue

public void setValue(java.lang.String newValue)
Invisible:

getValue

public java.lang.String getValue()
Invisible:

mouseEvent

public void mouseEvent(java.awt.event.MouseEvent e)
Overrides:
mouseEvent in class RiGUIWidget
Invisible:

resetEnterCode

public 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. A value of -1 will disable this trigger (so that the entered text is never processed).


getEnterCode

public 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.


keyEvent

public void keyEvent(java.awt.event.KeyEvent e)
Overrides:
keyEvent in class RiGUIWidget
Invisible:

draw

public void draw()
Specified by:
draw in interface TextField
Overrides:
draw in class RiGUIWidget
Invisible:

actionPerformed

public void actionPerformed(RiGUIEvent e)
Overrides:
actionPerformed in class RiGUIWidget
Invisible:

setActiveColor

public void setActiveColor(float r,
                           float g,
                           float b,
                           float alpha)
Description copied from interface: TextField
Set the active color for this object

Specified by:
setActiveColor in interface TextField
Parameters:
r - red component (0-255)
g - green component (0-255)
b - blue component (0-255)
alpha - transparency (0-255)

setActiveColor

public void setActiveColor(float gray)
Specified by:
setActiveColor in interface TextField

setActiveColor

public void setActiveColor(float gray,
                           float alpha)
Specified by:
setActiveColor in interface TextField

setActiveColor

public void setActiveColor(float r,
                           float g,
                           float b)
Specified by:
setActiveColor in interface TextField

setBgColor

public void setBgColor(float r,
                       float g,
                       float b,
                       float alpha)
Description copied from interface: TextField
Set the bg color for this object

Specified by:
setBgColor in interface TextField
Parameters:
r - red component (0-255)
g - green component (0-255)
b - blue component (0-255)
alpha - transparency (0-255)

setBgColor

public void setBgColor(float gray,
                       float alpha)
Specified by:
setBgColor in interface TextField

setBgColor

public void setBgColor(float r,
                       float g,
                       float b)
Specified by:
setBgColor in interface TextField

setBgColor

public void setBgColor(float gray)
Specified by:
setBgColor in interface TextField

setColor

public void setColor(float r,
                     float g,
                     float b,
                     float a)

setColor

public void setColor(float gray)

setColor

public void setColor(float gray,
                     float alpha)

setColor

public void setColor(float r,
                     float g,
                     float b)

setFgColor

public void setFgColor(float r,
                       float g,
                       float b,
                       float alpha)
Description copied from interface: TextField
Set the fg color for this object

Specified by:
setFgColor in interface TextField
Parameters:
r - red component (0-255)
g - green component (0-255)
b - blue component (0-255)
alpha - transparency (0-255)

setFgColor

public void setFgColor(float gray)
Specified by:
setFgColor in interface TextField

setFgColor

public void setFgColor(float gray,
                       float alpha)
Specified by:
setFgColor in interface TextField

setFgColor

public void setFgColor(float r,
                       float g,
                       float b)
Specified by:
setFgColor in interface TextField

setVisible

public void setVisible(boolean visible)
Sets whether the text-field should be drawn (default=true)

Specified by:
setVisible in interface TextField

isVisible

public boolean isVisible()
Returns true if the object is visible


getTextOffsetY

public float getTextOffsetY()
Returns the current Y-offset for typed text


setTextOffsetY

public void setTextOffsetY(float textOffset)
Sets the Y-offset for typed text