Ascent Phase Corp.

org.ascentphase.suit
Class QwertyKeyboard

java.lang.Object
  |
  +--org.ascentphase.suit.Widget
        |
        +--org.ascentphase.suit.QwertyKeyboard

public class QwertyKeyboard
extends Widget

A Widget that display the QWERTY keyboard layout so the user can enter text via a pointer.

Version:
Author:
huyd

Field Summary
static int BACKSPACE_KEY
           
static int CLEAR_KEY
           
protected  int height
           
protected  char highlightKey
           
protected  char lastKeySelected
           
static int SHIFT_KEY
           
protected  boolean shifted
           
 
Fields inherited from class org.ascentphase.suit.Widget
cmdToThrow
 
Constructor Summary
QwertyKeyboard()
           
 
Method Summary
 boolean contains(int x, int y)
          Returns whether the given coordinate lies within this widget's area of interest.
 char getLastKeySelected()
          Returns the character value of the last key pressed on the keyboard.
 void paint(Graphics g)
          Draws the widget.
 Command pointerPressed(int x, int y)
          Method called by the widget's containing Panel when a pointer is pressed over the widget area.
 Command pointerReleased(int x, int y)
          Method called by the widget's containing Panel when a pointer is released over the widget area.
 
Methods inherited from class org.ascentphase.suit.Widget
getCommand, keyPressed, keyReleased, pointerDragged, setCommand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SHIFT_KEY

public static final int SHIFT_KEY
See Also:
Constant Field Values

CLEAR_KEY

public static final int CLEAR_KEY
See Also:
Constant Field Values

BACKSPACE_KEY

public static final int BACKSPACE_KEY
See Also:
Constant Field Values

shifted

protected boolean shifted

height

protected int height

lastKeySelected

protected char lastKeySelected

highlightKey

protected char highlightKey
Constructor Detail

QwertyKeyboard

public QwertyKeyboard()
Method Detail

paint

public void paint(Graphics g)
Draws the widget.

Specified by:
paint in class Widget
Parameters:
g - the Graphics object to draw with.

contains

public boolean contains(int x,
                        int y)
Description copied from class: Widget
Returns whether the given coordinate lies within this widget's area of interest. The coordinate is relative to this widget's coordinate system. This method should return true if the coordinate given is of interest to the widget and the widget wishes to receive the keyXXX events and the pointerXXX events.

Overrides:
contains in class Widget
Parameters:
x - the x coordinate.
y - the y coordinate.

pointerPressed

public Command pointerPressed(int x,
                              int y)
Description copied from class: Widget
Method called by the widget's containing Panel when a pointer is pressed over the widget area. By default, if this method is not over-ridden, it returns null to indicate no Command event.

Overrides:
pointerPressed in class Widget
Parameters:
x - the x-coordinate relative to the widget's origin.
y - the y-coordinate relative to the widget's origin.
Returns:
a Command event to notify any listeners, or null if none.

pointerReleased

public Command pointerReleased(int x,
                               int y)
Description copied from class: Widget
Method called by the widget's containing Panel when a pointer is released over the widget area. By default, if this method is not over-ridden, it returns null to indicate no Command event.

Overrides:
pointerReleased in class Widget
Parameters:
x - the x-coordinate relative to the widget's origin.
y - the y-coordinate relative to the widget's origin.
Returns:
a Command event to notify any listeners, or null if none.

getLastKeySelected

public char getLastKeySelected()
Returns the character value of the last key pressed on the keyboard. If the last key pressed was the "SHIFT" key, it will return the key pressed before the "SHIFT" key was pressed.

Returns:
the last key pressed.

Ascent Phase Corp.

Copyright © 2002 Ascent Phase Corp. All Rights Reserved.