All Methods
zio package

context

zio
Class ZKeyboard

java.lang.Object
  extended byzio.ZObject
      extended byzio.ZKeyboard

public class ZKeyboard
extends ZObject

Defines a area for user input.

This class may be used in two ways

  1. Make a subclass that overrides the action method. This method is invoked and given the user's input whenever the user presses the enter key.
  2. Create a submit button and execute this class's getText method from it. (Currently, this way will require knowledge of Swing and a use of ZComponent.)

An example

class MyKeyboard extends ZKeyboard { public void action(String userin) { Zio.show(userin); } }

creates a class whose objects will show an input area on the screen. When the user enters something, it will appear in the command window.

Version:
Jul 22, 2005
Author:
copyright 2005 by J Adrian Zimmer
Licensed under the Open Software License version 2.1

Constructor Summary
ZKeyboard()
          Creates a ZKeyboard object.
 
Method Summary
protected  void action(java.lang.String userin)
          Action taken when the user presses enter.
 ZKeyboard background(java.awt.Color c)
          Suffix that determines the background color of the ZKeyboard.
 ZKeyboard canOverflow()
          Suffix that enables user to type more text than can be displayed.
 ZKeyboard debug(java.lang.String debugId)
          Suffix that creates debug output.
 ZKeyboard expandH()
          Suffix that enables horizontal stretching.
 ZKeyboard foreground(java.awt.Color c)
          Suffix that sets the foreground color.
 java.lang.String getText()
          Returns the text which has been entered.
 ZKeyboard numCols(int numColumns)
          Suffix that sets the approximate number of columns the user can enter without auto scrolling.
 ZKeyboard pointSize(int pointSize)
          Suffix which alters the point size of the font.
 ZKeyboard setFont(java.awt.Font f)
          Suffix which sets the font used when the user enters data in this object.
 ZKeyboard setText(java.lang.String text)
          Overwrites the user input area.
 
Methods inherited from class zio.ZObject
getSize
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ZKeyboard

public ZKeyboard()
Creates a ZKeyboard object. The default data entry area is approximately 25 characters.

Method Detail

setFont

public final ZKeyboard setFont(java.awt.Font f)
Suffix which sets the font used when the user enters data in this object.

Parameters:
f - the desired font

numCols

public final ZKeyboard numCols(int numColumns)
Suffix that sets the approximate number of columns the user can enter without auto scrolling.

Parameters:
numColumns - the desired number of columns

background

public final ZKeyboard background(java.awt.Color c)
Suffix that determines the background color of the ZKeyboard. The background color will be seen in the spaces.

Parameters:
c - the desired color

foreground

public final ZKeyboard foreground(java.awt.Color c)
Suffix that sets the foreground color. This is the color of the user's text entries.


debug

public final ZKeyboard debug(java.lang.String debugId)
Suffix that creates debug output.

Parameters:
debugId - a string to identify this ZKeyboard in the debug output

canOverflow

public final ZKeyboard canOverflow()
Suffix that enables user to type more text than can be displayed.


expandH

public final ZKeyboard expandH()
Suffix that enables horizontal stretching. Use this to allow the keyboard to be streched in a horizontal direction when the user resizes the window. This suffix also does the canOverflow() modification.


pointSize

public final ZKeyboard pointSize(int pointSize)
Suffix which alters the point size of the font.

Parameters:
pointSize - the desired point size

setText

public final ZKeyboard setText(java.lang.String text)
Overwrites the user input area.

Parameters:
text - what you want to see in the user input area

getText

public final java.lang.String getText()
Returns the text which has been entered. May be used like a suffix but is not restricted to such use.

Returns:
the text entered by the user

action

protected void action(java.lang.String userin)
Action taken when the user presses enter. Override this in a subclass to do what you like.

Parameters:
userin - the text entered by the user

author
context