code: @Override
  	public void keyReleased(KeyEvent e){
  
  		int code = e.getKeyCode();
  		//String s = e.getKeyText(code);
  		//System.out.println(s);
  		if (( code == KeyEvent.VK_UP ) ||
  				( code == KeyEvent.VK_KP_UP)) {
  			// go one back in history;
  			if ( historyPosition > 0){
  				historyPosition= historyPosition-1;
  			}
  		} else if (( code == KeyEvent.VK_DOWN ) ||
  				( code == KeyEvent.VK_KP_DOWN)) {
  			if ( historyPosition < (history.size()-1) ){
  				historyPosition++;
  			} else {
  				// clear command if at beginning of history
  				textfield.setText("");
  				historyPosition=history.size();
  				return;
  			}
  		} else if ( code == KeyEvent.VK_PAGE_UP) {
  			if ( historyPosition > 0) {
  				historyPosition = 0;
  			}
  		} else if ( code == KeyEvent.VK_PAGE_DOWN) {
  			if ( historyPosition >= 0) {
  				historyPosition = history.size()-1;
  			}
  		} else {
  			// some other key has been pressed, do nothing
  			return;
  		}
  
  		if ( historyPosition >= 0) {
  			String txt = history.get(historyPosition);
  			textfield.setText(txt);
  		}
  
  
  	}
docs: takes care of the cursor up/down keys. triggers copying of stored
  commands into the current textfield