Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD

Class gui.TextInput

java.lang.Object
  |
  +--java.awt.Component
        |
        +--java.awt.Container
              |
              +--java.awt.Panel
                    |
                    +--gui.TextInput

public class TextInput
extends java.awt.Panel
Provides a handy collection of an input field, an Execute button (or whatever you decide to call it), and a Clear button (to clear the text field). When the user clicks on the execute button, or types a carriage return in the input field, an ACTION_EVENT is posted.

See Also:
java.awt.Event, java.awt.TextField, Serialized Form

Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Constructor Summary
TextInput(int nChars, java.lang.String name)
          Creates a TextInput panel.
TextInput(int nChars, java.lang.String name, java.lang.String label)
          Creates a TextInput panel.
 
Method Summary
void execute(java.lang.String text)
          Posts an ACTION_EVENT with the input text as arg.
java.lang.String getText()
          Returns the text of the TextField.
boolean handleEvent(java.awt.Event e)
          Handles events on the TextInput panel.
void setText(java.lang.String text)
          Sets the text of the TextField.
 
Methods inherited from class java.awt.Panel
addNotify
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addNotify, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getAlignmentX, getAlignmentY, getComponentAt, getComponentAt, getComponent, getComponentCount, getComponents, getInsets, getLayout, getMaximumSize, getMinimumSize, getPreferredSize, insets, invalidate, isAncestorOf, layout, list, list, locate, minimumSize, paintComponents, paint, paramString, preferredSize, printComponents, print, processContainerEvent, processEvent, removeAll, remove, remove, removeContainerListener, removeNotify, setLayout, update, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addInputMethodListener, addKeyListener, addMouseListener, addMouseMotionListener, addNotify, addPropertyChangeListener, addPropertyChangeListener, bounds, checkImage, checkImage, coalesceEvents, contains, contains, createImage, createImage, deliverEvent, disable, disableEvents, dispatchEvent, doLayout, enable, enable, enableEvents, enableInputMethods, firePropertyChange, getAlignmentX, getAlignmentY, getBackground, getBounds, getBounds, getColorModel, getComponentAt, getComponentAt, getComponentOrientation, getCursor, getDropTarget, getFont, getFontMetrics, getForeground, getGraphics, getHeight, getInputContext, getInputMethodRequests, getLocale, getLocation, getLocation, getLocationOnScreen, getMaximumSize, getMinimumSize, getName, getParent, getPeer, getPreferredSize, getSize, getSize, getToolkit, getTreeLock, getWidth, getX, getY, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, invalidate, isDisplayable, isDoubleBuffered, isEnabled, isFocusTraversable, isLightweight, isOpaque, isShowing, isValid, isVisible, keyDown, keyUp, layout, list, list, list, list, list, locate, location, lostFocus, minimumSize, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, paint, paramString, postEvent, preferredSize, prepareImage, prepareImage, printAll, print, processComponentEvent, processEvent, processFocusEvent, processInputMethodEvent, processKeyEvent, processMouseEvent, processMouseMotionEvent, remove, removeComponentListener, removeFocusListener, removeInputMethodListener, removeKeyListener, removeMouseListener, removeMouseMotionListener, removeNotify, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, repaint, requestFocus, reshape, resize, resize, setBackground, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setEnabled, setFont, setForeground, setLocale, setLocation, setLocation, setName, setSize, setSize, setVisible, show, show, size, toString, transferFocus, update, validate
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notifyAll, notify, toString, wait, wait, wait
 

Constructor Detail

TextInput

public TextInput(int nChars,
                 java.lang.String name)
Creates a TextInput panel. It will have room for nChars characters. The `Execute' button will be named name.

TextInput

public TextInput(int nChars,
                 java.lang.String name,
                 java.lang.String label)
Creates a TextInput panel. It will have room for nChars characters. The `Execute' button will be named name. A label will precede the TextField on the row.
Method Detail

getText

public java.lang.String getText()
Returns the text of the TextField.

setText

public void setText(java.lang.String text)
Sets the text of the TextField.

execute

public void execute(java.lang.String text)
Posts an ACTION_EVENT with the input text as arg. This method may be overridden to provide different behavior.

handleEvent

public boolean handleEvent(java.awt.Event e)
Handles events on the TextInput panel. Clicking the clear button clears the TextField. Clicking the `Execute' button, or typing an Enter into the TextField, causes the text to be `execute'd.
Overrides:
handleEvent in class java.awt.Component

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS | NEXT CLASS FRAMES  | NO FRAMES
SUMMARY:  INNER | FIELD | CONSTR | METHOD DETAIL:  FIELD | CONSTR | METHOD