case KeyEvent.VK_TAB:
case KeyEvent.VK_TAB: ke.consume();  currentLine.complete(currentPrompt);  if (completion.needNewPrompt()) { currentLine.start(true); } refreshCurrentLine();  break;  default:  char ch = ke.getKeyChar(); if (!Character.isISOControl(ch)) { if (ke.isControlDown() && ch == 'l') { this.console.clear(); this.console.setCursor((currentPrompt != null ? currentPrompt.length() : this.console.getWidth() - 1), 1); currentLine.start(); refreshCurrentLine(); } else {
    public void keyPressed(KeyboardEvent ke) {        //  make sure we are ready to intercept the keyboard        if (!isActive) return;        switch (ke.getKeyCode()) {        //  intercept the up and down arrow keys        case KeyEvent.VK_UP:            ke.consume();            if (historyIndex == -1) {                newestLine = currentLine.getContent();                historyIndex = history.size();            }            historyIndex--;            redisplay();            break;        case KeyEvent.VK_DOWN:            ke.consume();            if (historyIndex == history.size() - 1)                historyIndex = -2;            else if (historyIndex == -1) newestLine = currentLine.getContent();            historyIndex++;            redisplay();            break;        case KeyEvent.VK_LEFT:            //Left the cursor goes left            ke.consume();            if (currentLine.moveLeft()) {                refreshCurrentLine();            }            break;        case KeyEvent.VK_RIGHT:            // Right the cursor goes right            ke.consume();            if (currentLine.moveRight()) {                refreshCurrentLine();            }            break;        case KeyEvent.VK_HOME:            // The cursor goes at the start            ke.consume();            currentLine.moveBegin();            refreshCurrentLine();            break;        case KeyEvent.VK_END:            // the cursor goes at the end of line            ke.consume();        	currentLine.moveEnd();                        refreshCurrentLine();            break;        //  if its a backspace we want to remove one from the end of our current        // line        case KeyEvent.VK_BACK_SPACE:            ke.consume();            if (currentLine.backspace()) {                refreshCurrentLine();            }            break;        //  if its a delete we want to remove one under the cursor        case KeyEvent.VK_DELETE:            ke.consume();        	currentLine.delete();            refreshCurrentLine();            break;        //  if its an enter key we want to process the command, and then resume        // the thread        case KeyEvent.VK_ENTER:            ke.consume();                    currentLine.moveEnd();        	refreshCurrentLine();            out.print(ke.getKeyChar());            synchronized (this) {                isActive = false;                threadSuspended = false;                notifyAll();            }            break;        // if it's the tab key, we want to trigger command line completion        case KeyEvent.VK_TAB:            ke.consume();        	/*CompletionInfo info =*/ currentLine.complete(currentPrompt);    		if(completion.needNewPrompt())    		{			    	        currentLine.start(true);    		}    		refreshCurrentLine();    		                    break;                default:            //  if its a useful key we want to add it to our current line        	char ch = ke.getKeyChar();            if (!Character.isISOControl(ch)) {                if(ke.isControlDown() && ch == 'l'){                    this.console.clear();                    this.console.setCursor(this.console.getWidth() - 1 ,1);                    currentLine.start();                    refreshCurrentLine();                } else {                    ke.consume();                    currentLine.appendChar(ch);                    refreshCurrentLine();                }            }        }    }