Package ImplementacionTeclado

Source Code of ImplementacionTeclado.DriverTeclado

/*
* File:        DriverTeclado.java
*
*
*     This file is a part of MICE, a program designed for
*              people with severe motor disabilities to whom it is impossible
*              to use a traditional mouse. This application gives these people
*              the control of the physical mouse via another type of device.
*
* Authors:     Isabel Gonzalez
* Date:        2008/ 2009
*
* Company:     Colegio Publico de Educacion Especial Alborada, Zaragoza
*              DIIS, Universidad de Zaragoza
*
* License:     Copyright (C) 2008
*
*              This program is free software: you can redistribute it and/or modify
*              it under the terms of the GNU General Public License as published by
*              the Free Software Foundation, either version 3 of the License, or
*              (at your option) any later version.
*
*              This program is distributed in the hope that it will be useful,
*              but WITHOUT ANY WARRANTY; without even the implied warranty of
*              MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
*              GNU General Public License for more details.
*
*              You should have received a copy of the GNU General Public License
*              along with this program.  If not, see <http://www.gnu.org/licenses/>.
*
*
*
*
*/


package ImplementacionTeclado;

// DriverTeclado.java
import ImplementacionTeclado.KeyboardEvent;
import ImplementacionTeclado.KeyboardEventListener;
import ImplementacionTeclado.KeyboardHook;
import java.io.*;
public class DriverTeclado implements KeyboardEventListener
{
  public static void main( String args[] )
  {
                System.out.println("entra");
    KeyboardHook kh = new KeyboardHook();
                System.out.println("despues");
    kh.addEventListener( new DriverTeclado() );
    BufferedReader br = new BufferedReader( new InputStreamReader( System.in ) );
               // System.out.println("hola");
    try{
      br.readLine();
                    //    System.out.println("try");
    } catch( IOException ex ) {
                 System.err.println("exception:"+ex.toString()); }
  }
  public void GlobalKeyPressed( KeyboardEvent event )
  {
                //System.out.println("hola2");
    //System.out.println( "Key Pressed: " + event.getVirtualKeyCode() );
                if ((event.getVirtualKeyCode()==81)||(event.getVirtualKeyCode()==87)||
                  (event.getVirtualKeyCode()==69)||(event.getVirtualKeyCode()==82)||
                  (event.getVirtualKeyCode()==84)||(event.getVirtualKeyCode()==89)||
                  (event.getVirtualKeyCode()==86)||(event.getVirtualKeyCode()==73)){
                       //EnviaSystem.out.println("arriba");
                       //return mov_arriba;
                }
                else if ((event.getVirtualKeyCode()==65)||(event.getVirtualKeyCode()==83)||
                  (event.getVirtualKeyCode()==68)||(event.getVirtualKeyCode()==70)||
                  (event.getVirtualKeyCode()==71)||(event.getVirtualKeyCode()==72)){
                       System.out.println("izquierda");
                    
                }
                else if ((event.getVirtualKeyCode()==74)||(event.getVirtualKeyCode()==75)||
                  (event.getVirtualKeyCode()==76)){
                       System.out.println("derecha");
                }
                else if ((event.getVirtualKeyCode()==90)||(event.getVirtualKeyCode()==88)||
                  (event.getVirtualKeyCode()==67)||(event.getVirtualKeyCode()==86)||
                  (event.getVirtualKeyCode()==66)||(event.getVirtualKeyCode()==78)||
                  (event.getVirtualKeyCode()==77)){
                       System.out.println("abajo");
  }
        }
  public void GlobalKeyReleased( KeyboardEvent event )
  {
               // System.out.println("hola3");
               // System.out.println( "Key Released: " + event.getVirtualKeyCode() );
  }
}
TOP

Related Classes of ImplementacionTeclado.DriverTeclado

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.