1 txtStartDate.addKeyListener(new KeyAdapter() 2 { 3 public void keyTyped(KeyEvent e) 4 { 5 int keyChar = e.getKeyChar(); 6 if(KeyEvent.VK_SPACE == keyChar) 7 { 8 e.consume(); 9 } 10 } 11 });