jmce - 1_02

jmce.sinclair.spectrum
Class SwingKeyboard

java.lang.Object
  extended by jmce.sim.AbstractHardware
      extended by jmce.sim.AbstractPeripheral
          extended by jmce.sinclair.spectrum.SwingKeyboard
All Implemented Interfaces:
java.awt.event.FocusListener, java.awt.event.KeyListener, java.util.EventListener, Hardware, Peripheral, SpectrumConstants

public class SwingKeyboard
extends AbstractPeripheral
implements java.awt.event.FocusListener, java.awt.event.KeyListener, SpectrumConstants

AWT keyboord for spectrum.

This device can be child of any SwingHardare and implements the spectrum keyboard on the parent component.

Version:
1.00
Author:
Mario Viara

Field Summary
static int[][] keys
          Keyboard mapping
 
Fields inherited from class jmce.sim.AbstractPeripheral
cpu
 
Fields inherited from interface jmce.sinclair.spectrum.SpectrumConstants
ATTRIBUTE_BRIGHT, ATTRIBUTE_FLASH, MMU_DISABLE, MMU_PORT, MMU_ROM, MMU_VIDEO, ROM_MEMORY_END, SCREEN_ATTRIBUTE_END, SCREEN_ATTRIBUTE_SIZE, SCREEN_ATTRIBUTE_START, SCREEN_MEMORY_END, SCREEN_MEMORY_SIZE, SCREEN_MEMORY_START, ULA_BORDER, ULA_IN, ULA_KBD, ULA_MIC, ULA_OUT, ULA_PORT
 
Constructor Summary
SwingKeyboard()
           
 
Method Summary
 void dokey(int key, boolean mode)
           
 void dokey(int r, int c, boolean pressed)
           
 void focusGained(java.awt.event.FocusEvent e)
           
 void focusLost(java.awt.event.FocusEvent e)
           
 int inb(int port, int hi)
           
 void init(Hardware parent)
          Initialize the hardware.
 void keyPressed(java.awt.event.KeyEvent e)
           
 void keyReleased(java.awt.event.KeyEvent e)
           
 void keyTyped(java.awt.event.KeyEvent e)
           
 void registerCPU(CPU cpu)
          Register a parent CPU for future reference.
 
Methods inherited from class jmce.sim.AbstractPeripheral
idle, setIdle, setLive
 
Methods inherited from class jmce.sim.AbstractHardware
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName, toString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface jmce.sim.Hardware
addHardware, destroy, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareInstances, getHardwareTree, getName, getParent, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName
 

Field Detail

keys

public static final int[][] keys
Keyboard mapping

Constructor Detail

SwingKeyboard

public SwingKeyboard()
Method Detail

init

public void init(Hardware parent)
          throws SIMException
Description copied from interface: Hardware
Initialize the hardware. This method must be called before any use of the interface. Only set ... / get ... method are allowed to be called before the intialization.

Specified by:
init in interface Hardware
Overrides:
init in class AbstractHardware
Parameters:
parent - Parent of this hardware.
Throws:
SIMException

registerCPU

public void registerCPU(CPU cpu)
                 throws SIMException
Description copied from interface: Peripheral
Register a parent CPU for future reference.

Specified by:
registerCPU in interface Peripheral
Overrides:
registerCPU in class AbstractPeripheral
Throws:
SIMException

inb

public int inb(int port,
               int hi)

keyPressed

public void keyPressed(java.awt.event.KeyEvent e)
Specified by:
keyPressed in interface java.awt.event.KeyListener

dokey

public void dokey(int key,
                  boolean mode)

keyReleased

public void keyReleased(java.awt.event.KeyEvent e)
Specified by:
keyReleased in interface java.awt.event.KeyListener

keyTyped

public void keyTyped(java.awt.event.KeyEvent e)
Specified by:
keyTyped in interface java.awt.event.KeyListener

dokey

public void dokey(int r,
                  int c,
                  boolean pressed)

focusGained

public void focusGained(java.awt.event.FocusEvent e)
Specified by:
focusGained in interface java.awt.event.FocusListener

focusLost

public void focusLost(java.awt.event.FocusEvent e)
Specified by:
focusLost in interface java.awt.event.FocusListener

jmce - 1_02