org.diamondspin
Class DSKeyboardPanel

java.lang.Object
  extended by java.awt.Component
      extended by java.awt.Container
          extended by javax.swing.JComponent
              extended by javax.swing.JPanel
                  extended by org.diamondspin.DSKeyboardPanel
All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, Accessible

public class DSKeyboardPanel
extends JPanel

DSKeyboardPanel is a JPanel with buttons in its layout (as a physical keyboard). It can be included in DSFrame to replace the lack of keyboard on DiamondTouch.

Copyright 2002-2009 DiamondSpin project. All Rights Reserved.

Permission to use, copy, modify and distribute this software and its documentation for educational, research and non-profit purposes, without fee, and without a written agreement is hereby granted, provided that the above copyright notice and the following three paragraphs appear in all copies.

To request Permission to incorporate this software into commercial products contact one of the authors of the project.
  • Frederic Vernier (frederic.vernier@limsi.fr)
  • Chia Shen (chia_shen@harvard.edu)
  • Guillaume Besacier (guillaume.besacier@limsi.fr)
  • Daniel Wigdor (dwigdor@microsoft.com)

IN NO EVENT SHALL THE AUTHORS BE LIABLE TO ANY PARTY FOR DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES, INCLUDING LOST PROFITS, ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE AUTHORS HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.

THE AUTHORS SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS ON AN "AS IS" BASIS, AND THE AUTHORS HAS NO OBLIGATIONS TO PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS.
Creation date : april 19th 2002

Version:
: 1.0
Author:
: Guillaume Besacier, Frederic vernier, (frederic.vernier@gmail.com) and Meredith Ringel (merrie@stanford.edu) under Chia Shen supervision (chia_shen@harvard.edu).
See Also:
Serialized Form

Nested Class Summary
protected  class DSKeyboardPanel.KeybdMouseAdapter
           
 
Nested classes/interfaces inherited from class javax.swing.JPanel
JPanel.AccessibleJPanel
 
Nested classes/interfaces inherited from class javax.swing.JComponent
JComponent.AccessibleJComponent
 
Nested classes/interfaces inherited from class java.awt.Container
Container.AccessibleAWTContainer
 
Nested classes/interfaces inherited from class java.awt.Component
Component.AccessibleAWTComponent, Component.BaselineResizeBehavior, Component.BltBufferStrategy, Component.FlipBufferStrategy
 
Field Summary
static int AZERTY
           
protected  Color BackgroundColor
           
protected  JButton[] buttons
           
protected static Clip click
           
protected  int IDOwner
           
protected  int keyboardType
           
protected  Color KeyColor
           
protected  JPanel[] lines
           
protected  DSKeyboardPanel.KeybdMouseAdapter mouseAdapt
           
static int QWERTY
           
protected  Color TextColor
           
 
Fields inherited from class javax.swing.JComponent
accessibleContext, listenerList, TOOL_TIP_TEXT_KEY, ui, UNDEFINED_CONDITION, WHEN_ANCESTOR_OF_FOCUSED_COMPONENT, WHEN_FOCUSED, WHEN_IN_FOCUSED_WINDOW
 
Fields inherited from class java.awt.Component
BOTTOM_ALIGNMENT, CENTER_ALIGNMENT, LEFT_ALIGNMENT, RIGHT_ALIGNMENT, TOP_ALIGNMENT
 
Fields inherited from interface java.awt.image.ImageObserver
ABORT, ALLBITS, ERROR, FRAMEBITS, HEIGHT, PROPERTIES, SOMEBITS, WIDTH
 
Constructor Summary
DSKeyboardPanel()
          Constructor
DSKeyboardPanel(int keyboardType)
          Constructor
DSKeyboardPanel(int num, int denom)
           
DSKeyboardPanel(int num, int denom, int keyboardType)
           
 
Method Summary
 void addKeyListener(KeyListener KeyListener_Arg)
          register a key listener who want to listen this virtual keyboard key events
protected  void fireKeyPressed(int KeyCode_Arg, char KeyChar_Arg)
           
 void fireKeyPressed(String butName)
           
protected  void fireKeyReleased(int KeyCode_Arg, char KeyChar_Arg)
           
 void fireKeyReleased(String butName)
           
protected  void fireKeyTyped(int KeyCode_Arg, char KeyChar_Arg)
           
 void fireKeyTyped(String butName)
           
 Color getBackgroundColor()
           
 int getIDOwner()
           
 Color getKeyColor()
           
 String getLetters(int butNum)
          Dans l'ordre : lower-case, upper-case, KeyCode (on se restreint donc aux keycodes sur un seul byte, pas de keycodes exotiques ou étendus ici (touche 'cut', 'stop',...
 Dimension getMinimumSize()
          return the Minimum Size for this keyboard.
 Dimension getPreferredSize()
          return the Preferred Size for this keyboard.
 Color getTextColor()
           
 void initComponents()
          init the sub-components.
static void playClick()
           
static void prepareClick()
           
 void removeKeyListener(KeyListener KeyListener_Arg)
          unregister a key listener who want to listen this virtual keyboard key events
 void setBackgroundColor(Color BackgroundColor)
           
 void setIDOwner(int Id)
           
 void setKeyColor(Color KeyColor)
           
 void setTextColor(Color TextColor)
           
 void updateKeyboard()
          udpade the keyboard keys according to the shift (caps lock)
 
Methods inherited from class javax.swing.JPanel
getAccessibleContext, getUI, getUIClassID, paramString, setUI, updateUI
 
Methods inherited from class javax.swing.JComponent
addAncestorListener, addNotify, addVetoableChangeListener, computeVisibleRect, contains, createToolTip, disable, enable, firePropertyChange, firePropertyChange, firePropertyChange, fireVetoableChange, getActionForKeyStroke, getActionMap, getAlignmentX, getAlignmentY, getAncestorListeners, getAutoscrolls, getBaseline, getBaselineResizeBehavior, getBorder, getBounds, getClientProperty, getComponentGraphics, getComponentPopupMenu, getConditionForKeyStroke, getDebugGraphicsOptions, getDefaultLocale, getFontMetrics, getGraphics, getHeight, getInheritsPopupMenu, getInputMap, getInputMap, getInputVerifier, getInsets, getInsets, getListeners, getLocation, getMaximumSize, getNextFocusableComponent, getPopupLocation, getRegisteredKeyStrokes, getRootPane, getSize, getToolTipLocation, getToolTipText, getToolTipText, getTopLevelAncestor, getTransferHandler, getVerifyInputWhenFocusTarget, getVetoableChangeListeners, getVisibleRect, getWidth, getX, getY, grabFocus, isDoubleBuffered, isLightweightComponent, isManagingFocus, isOpaque, isOptimizedDrawingEnabled, isPaintingForPrint, isPaintingTile, isRequestFocusEnabled, isValidateRoot, paint, paintBorder, paintChildren, paintComponent, paintImmediately, paintImmediately, print, printAll, printBorder, printChildren, printComponent, processComponentKeyEvent, processKeyBinding, processKeyEvent, processMouseEvent, processMouseMotionEvent, putClientProperty, registerKeyboardAction, registerKeyboardAction, removeAncestorListener, removeNotify, removeVetoableChangeListener, repaint, repaint, requestDefaultFocus, requestFocus, requestFocus, requestFocusInWindow, requestFocusInWindow, resetKeyboardActions, reshape, revalidate, scrollRectToVisible, setActionMap, setAlignmentX, setAlignmentY, setAutoscrolls, setBackground, setBorder, setComponentPopupMenu, setDebugGraphicsOptions, setDefaultLocale, setDoubleBuffered, setEnabled, setFocusTraversalKeys, setFont, setForeground, setInheritsPopupMenu, setInputMap, setInputVerifier, setMaximumSize, setMinimumSize, setNextFocusableComponent, setOpaque, setPreferredSize, setRequestFocusEnabled, setToolTipText, setTransferHandler, setUI, setVerifyInputWhenFocusTarget, setVisible, unregisterKeyboardAction, update
 
Methods inherited from class java.awt.Container
add, add, add, add, add, addContainerListener, addImpl, addPropertyChangeListener, addPropertyChangeListener, applyComponentOrientation, areFocusTraversalKeysSet, countComponents, deliverEvent, doLayout, findComponentAt, findComponentAt, getComponent, getComponentAt, getComponentAt, getComponentCount, getComponents, getComponentZOrder, getContainerListeners, getFocusTraversalKeys, getFocusTraversalPolicy, getLayout, getMousePosition, insets, invalidate, isAncestorOf, isFocusCycleRoot, isFocusCycleRoot, isFocusTraversalPolicyProvider, isFocusTraversalPolicySet, layout, list, list, locate, minimumSize, paintComponents, preferredSize, printComponents, processContainerEvent, processEvent, remove, remove, removeAll, removeContainerListener, setComponentZOrder, setFocusCycleRoot, setFocusTraversalPolicy, setFocusTraversalPolicyProvider, setLayout, transferFocusBackward, transferFocusDownCycle, validate, validateTree
 
Methods inherited from class java.awt.Component
action, add, addComponentListener, addFocusListener, addHierarchyBoundsListener, addHierarchyListener, addInputMethodListener, addMouseListener, addMouseMotionListener, addMouseWheelListener, bounds, checkImage, checkImage, coalesceEvents, contains, createImage, createImage, createVolatileImage, createVolatileImage, disableEvents, dispatchEvent, enable, enableEvents, enableInputMethods, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, firePropertyChange, getBackground, getBounds, getColorModel, getComponentListeners, getComponentOrientation, getCursor, getDropTarget, getFocusCycleRootAncestor, getFocusListeners, getFocusTraversalKeysEnabled, getFont, getForeground, getGraphicsConfiguration, getHierarchyBoundsListeners, getHierarchyListeners, getIgnoreRepaint, getInputContext, getInputMethodListeners, getInputMethodRequests, getKeyListeners, getLocale, getLocation, getLocationOnScreen, getMouseListeners, getMouseMotionListeners, getMousePosition, getMouseWheelListeners, getName, getParent, getPeer, getPropertyChangeListeners, getPropertyChangeListeners, getSize, getToolkit, getTreeLock, gotFocus, handleEvent, hasFocus, hide, imageUpdate, inside, isBackgroundSet, isCursorSet, isDisplayable, isEnabled, isFocusable, isFocusOwner, isFocusTraversable, isFontSet, isForegroundSet, isLightweight, isMaximumSizeSet, isMinimumSizeSet, isPreferredSizeSet, isShowing, isValid, isVisible, keyDown, keyUp, list, list, list, location, lostFocus, mouseDown, mouseDrag, mouseEnter, mouseExit, mouseMove, mouseUp, move, nextFocus, paintAll, postEvent, prepareImage, prepareImage, processComponentEvent, processFocusEvent, processHierarchyBoundsEvent, processHierarchyEvent, processInputMethodEvent, processMouseWheelEvent, remove, removeComponentListener, removeFocusListener, removeHierarchyBoundsListener, removeHierarchyListener, removeInputMethodListener, removeMouseListener, removeMouseMotionListener, removeMouseWheelListener, removePropertyChangeListener, removePropertyChangeListener, repaint, repaint, repaint, resize, resize, setBounds, setBounds, setComponentOrientation, setCursor, setDropTarget, setFocusable, setFocusTraversalKeysEnabled, setIgnoreRepaint, setLocale, setLocation, setLocation, setName, setSize, setSize, show, show, size, toString, transferFocus, transferFocusUpCycle
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

buttons

protected JButton[] buttons

lines

protected JPanel[] lines

KeyColor

protected Color KeyColor

TextColor

protected Color TextColor

BackgroundColor

protected Color BackgroundColor

QWERTY

public static final int QWERTY
See Also:
Constant Field Values

AZERTY

public static final int AZERTY
See Also:
Constant Field Values

keyboardType

protected int keyboardType

mouseAdapt

protected DSKeyboardPanel.KeybdMouseAdapter mouseAdapt

IDOwner

protected int IDOwner

click

protected static Clip click
Constructor Detail

DSKeyboardPanel

public DSKeyboardPanel()
Constructor


DSKeyboardPanel

public DSKeyboardPanel(int keyboardType)
Constructor


DSKeyboardPanel

public DSKeyboardPanel(int num,
                       int denom)

DSKeyboardPanel

public DSKeyboardPanel(int num,
                       int denom,
                       int keyboardType)
Method Detail

addKeyListener

public void addKeyListener(KeyListener KeyListener_Arg)
register a key listener who want to listen this virtual keyboard key events

Overrides:
addKeyListener in class Component

removeKeyListener

public void removeKeyListener(KeyListener KeyListener_Arg)
unregister a key listener who want to listen this virtual keyboard key events

Overrides:
removeKeyListener in class Component

fireKeyPressed

protected void fireKeyPressed(int KeyCode_Arg,
                              char KeyChar_Arg)

fireKeyTyped

protected void fireKeyTyped(int KeyCode_Arg,
                            char KeyChar_Arg)

fireKeyReleased

protected void fireKeyReleased(int KeyCode_Arg,
                               char KeyChar_Arg)

getLetters

public String getLetters(int butNum)
Dans l'ordre : lower-case, upper-case, KeyCode (on se restreint donc aux keycodes sur un seul byte, pas de keycodes exotiques ou étendus ici (touche 'cut', 'stop',... des claviers Sun, etc.))


updateKeyboard

public void updateKeyboard()
udpade the keyboard keys according to the shift (caps lock)


fireKeyPressed

public void fireKeyPressed(String butName)

fireKeyTyped

public void fireKeyTyped(String butName)

fireKeyReleased

public void fireKeyReleased(String butName)

getPreferredSize

public Dimension getPreferredSize()
return the Preferred Size for this keyboard.

Overrides:
getPreferredSize in class JComponent

getMinimumSize

public Dimension getMinimumSize()
return the Minimum Size for this keyboard.

Overrides:
getMinimumSize in class JComponent

initComponents

public final void initComponents()
init the sub-components. Has been generated by codewarrior.


setIDOwner

public void setIDOwner(int Id)

getIDOwner

public int getIDOwner()

prepareClick

public static void prepareClick()

playClick

public static void playClick()

getKeyColor

public Color getKeyColor()

setKeyColor

public void setKeyColor(Color KeyColor)

getTextColor

public Color getTextColor()

setTextColor

public void setTextColor(Color TextColor)

getBackgroundColor

public Color getBackgroundColor()

setBackgroundColor

public void setBackgroundColor(Color BackgroundColor)


Copyright © 2006 Frederic Vernier(LIMSI) Chia Shen(MERL) Guillaume Besacier(LIMSI). All Rights Reserved.