Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.awt.event.KeyEvent;
- import java.awt.event.*; //KeyListener
- public class KeyManager implements KeyListener
- {
- private Skeleton gameSk;
- /**
- * Constructor for objects of class KeyManager
- */
- public KeyManager( Skeleton sk )
- {
- // initialise instance variables
- gameSk = sk;
- }
- /** Handle the key typed event from the text field. */
- public void keyTyped(KeyEvent e)
- {
- //System.out.println( "Key typed: " + e.getKeyChar() );
- }
- /** Handle the key-pressed event from the text field. */
- public void keyPressed(KeyEvent e)
- {
- if( gameSk != null )
- gameSk.keyPressed( e );
- //System.out.println( "Key pressed: " + e.getKeyChar() );
- }
- /** Handle the key-released event from the text field. */
- public void keyReleased(KeyEvent e)
- {
- if( gameSk != null )
- gameSk.keyReleased( e );
- //System.out.println( "Key released: " + e.getKeyChar() );
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement