public void keyTyped(KeyEvent e) {
        if (e.getKeyChar() == 127) {
            sim.doDelete();
            return;
        }
        if (e.getKeyChar() > ' ' && e.getKeyChar() < 127) {
            Class c = sim.shortcuts[e.getKeyChar()];
            if (c == null) {
                return;
            }
            CircuitElm elm = null;
            elm = sim.constructElement(c, 0, 0);
            if (elm == null) {
                return;
            }
            sim.setMouseMode(MODE_ADD_ELM);
            sim.mouseModeStr = c.getName();
            sim.addingClass = c;
        }
        if (e.getKeyChar() == ' ' || e.getKeyChar() == KeyEvent.VK_ESCAPE) {
            sim.setMouseMode(MODE_SELECT);
            sim.mouseModeStr = "Select";
        }
        sim.tempMouseMode = sim.mouseMode;
    }