com.monkeycoder.monkeynes.gui
Class NesControllerKeyListener

java.lang.Object
  |
  +--com.monkeycoder.monkeynes.gui.NesControllerKeyListener
All Implemented Interfaces:
EventListener, KeyListener

public class NesControllerKeyListener
extends Object
implements KeyListener

This class converts key events into the appropriate button presses on a controller.

Originally part of the MonkeyNES project.

Author:
David Stephens

Constructor Summary
NesControllerKeyListener(NesController inPad1, NesController inPad2)
          Creates a new NesControllerKeyListener and tells it what controllers are in the 2 controller ports.
 
Method Summary
 void keyPressed(KeyEvent ke)
          Called when a key presseed event occurs.
 void keyReleased(KeyEvent ke)
          Called when a key released event occurs.
 void keyTyped(KeyEvent ke)
          Called when a key typed event occurs.
 void setPowerOn(boolean inPower)
          Called to tell the key listener whether power is on or off.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NesControllerKeyListener

public NesControllerKeyListener(NesController inPad1,
                                NesController inPad2)
Creates a new NesControllerKeyListener and tells it what controllers are in the 2 controller ports.

Parameters:
inPad1 - The controller plugged into port 1.
inPad2 - The controller plugged into port 2.
Method Detail

setPowerOn

public void setPowerOn(boolean inPower)
Called to tell the key listener whether power is on or off.

Parameters:
inPower - The new power state for this listener.

keyPressed

public void keyPressed(KeyEvent ke)
Called when a key presseed event occurs.

Specified by:
keyPressed in interface KeyListener
Parameters:
ke - The key event that just happened.

keyReleased

public void keyReleased(KeyEvent ke)
Called when a key released event occurs.

Specified by:
keyReleased in interface KeyListener
Parameters:
ke - The key event that just happened.

keyTyped

public void keyTyped(KeyEvent ke)
Called when a key typed event occurs.

Specified by:
keyTyped in interface KeyListener
Parameters:
ke - The key event that just happened.