/** * Capture keyboard input events and write all character data to the private pipe. The command * thread will read them from the other end as required. */ @Override public void keyPressed(KeyboardEvent event) { if (!event.isConsumed()) { char ch = event.getKeyChar(); if (ch != KeyboardEvent.NO_CHAR) { try { pw.write(ch); pw.flush(); } catch (IOException ex) { // ignore it } event.consume(); } } }
/** @see org.jnode.debugger.DebugState#process(KeyboardEvent) */ public DebugState process(KeyboardEvent event) { DebugState newState = this; switch (event.getKeyChar()) { case 'n': if (!threadIterator.hasNext()) { reset(); } if (threadIterator.hasNext()) { final Thread t = (Thread) threadIterator.next(); newState = new ThreadState(this, t, index++); } break; case 'r': reset(); break; default: return this; } event.consume(); return newState; }