|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjmce.sim.AbstractHardware
jmce.sim.AbstractPeripheral
jmce.swing.KeyboardMatrix
public class KeyboardMatrix
Keyboard matrix.
This swing peripheral can be connected to any AWT component and implements one matrix keyboard.
The matrix is organized in rows and columns. Normally the row are scanned one at once and if a key is pressed the relative columns bit is set to 0.
Field Summary | |
---|---|
protected int[][] |
keysLoc
|
protected int[] |
keyState
|
protected int |
numRows
|
Fields inherited from class jmce.sim.AbstractPeripheral |
---|
cpu |
Constructor Summary | |
---|---|
KeyboardMatrix()
Standard constructor |
Method Summary | |
---|---|
void |
focusGained(java.awt.event.FocusEvent e)
|
void |
focusLost(java.awt.event.FocusEvent e)
|
int |
getRow(int r)
Return the key state for the specified row. |
protected void |
keyEvent(int r,
int c,
boolean pressed)
Can be redefined in subclass to detect keyboard event for example to fire a interrupt. |
void |
keyEvent(java.awt.event.KeyEvent e,
boolean pressed)
|
void |
keyPressed(java.awt.event.KeyEvent e)
|
void |
keyReleased(java.awt.event.KeyEvent e)
|
void |
keyTyped(java.awt.event.KeyEvent e)
|
protected void |
resetKeyboard()
Reset the state of the keyboard. |
void |
setComponent(java.awt.Component c)
|
void |
setKey(int r,
int c,
int... keys)
|
void |
setKeyLocation(int r,
int c,
int... keys)
Set the location of specified key. |
void |
setNumCols(int c)
Set the number of columns of the matrix. |
void |
setNumRows(int r)
Set the number of row for the matrix |
java.lang.String |
toString()
|
Methods inherited from class jmce.sim.AbstractPeripheral |
---|
idle, registerCPU, setIdle, setLive |
Methods inherited from class jmce.sim.AbstractHardware |
---|
addHardware, createFrame, destroy, getHardware, getHardware, getHardware, getHardware, getHardware, getHardwareCount, getHardwareForName, getHardwareInstances, getHardwareTree, getName, getParent, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName |
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, init, initSwing, removeHardware, removeHardware, reset, setHardware, setHardware, setName |
Field Detail |
---|
protected int numRows
protected int[] keyState
protected int[][] keysLoc
Constructor Detail |
---|
public KeyboardMatrix()
Method Detail |
---|
protected void resetKeyboard()
public void setNumRows(int r)
public void setNumCols(int c)
public void setComponent(java.awt.Component c)
public int getRow(int r)
public void setKeyLocation(int r, int c, int... keys)
The location is used when the same key appear more than one time on the keyboard and can generate more than one code. A typical example are the LEFT / RIGHT shift.
public void setKey(int r, int c, int... keys)
public void focusGained(java.awt.event.FocusEvent e)
focusGained
in interface java.awt.event.FocusListener
public void focusLost(java.awt.event.FocusEvent e)
focusLost
in interface java.awt.event.FocusListener
public void keyPressed(java.awt.event.KeyEvent e)
keyPressed
in interface java.awt.event.KeyListener
public void keyReleased(java.awt.event.KeyEvent e)
keyReleased
in interface java.awt.event.KeyListener
public void keyTyped(java.awt.event.KeyEvent e)
keyTyped
in interface java.awt.event.KeyListener
public void keyEvent(java.awt.event.KeyEvent e, boolean pressed)
protected void keyEvent(int r, int c, boolean pressed)
public java.lang.String toString()
toString
in class AbstractHardware
|
jmce - 1_02 | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |