title: SHIFT + ENTER, & ENTER in the same component in Java
body: <p>In my program hte <kbd>SHIFT</kbd>+<kbd>ENTER</kbd> key does a new line in a text area, but when y remove the established behavior of the <kbd>ENTER</kbd> key the program crashes, can i do that?, add functionality for <kbd>SHIFT</kbd>+<kbd>ENTER</kbd> keys and remove the standard behavior of the Enter key.
  My following code is, for the  remove behavior of Enter key:</p>
  
  <pre><code>public void removeEnterBehavior(){
      KeyStroke enter = KeyStroke.getKeyStroke("ENTER");
      InputMap inputMap = messageTextArea.getInputMap();
      inputMap.put(enter, "none");
  }
  </code></pre>
  
  <p>For the new line with the <kbd>SHIFT</kbd>+<kbd>Enter</kbd> keys, my code is:</p>
  
  <pre><code>@Override
      public void keyPressed(KeyEvent e) {   
           if(e.getKeyCode() == KeyEvent.VK_ENTER &amp;&amp; (e.getModifiers() &amp; InputEvent.SHIFT_MASK) != 0){
               addNewLine();
           }
      }
  </code></pre>
  
  <p>Also the <kbd>ENTER</kbd> key have to call a method in the keyPressed method</p>