title: Detecting Shift modifiers on MouseEvent generated from click in swing
body: <p>I'm handling some MouseEvent in a GUI application using Java Swing.</p>
  
  <p>Since now i was analyzing mouse events inside mousePressed method, only to determine if 
  a left or right click happened.</p>
  
  <p>My code was:</p>
  
  <pre><code>public void mousePressed(MouseEvent me) {
      if (me.getModifiers == InputEvent.BUTTON1_DOWN_MASK){
       //left click
      }else if (me.getModifiers == InputEvent.BUTTON3_DOWN_MASK){
       //right click
       }
  </code></pre>
  
  <p>Now my application is becoming more complicated and I need also to check if Shift button was pressed while mouse was left clicking.
  I would like to do something like this:</p>
  
  <pre><code>public void mousePressed(MouseEvent me) {
      if (me.getModifiers == InputEvent.BUTTON1_DOWN_MASK &amp;&amp; me.isShiftDown()){
       //left click
      }
  </code></pre>
  
  <p>Now this doesn't work. In particular if I click the left button while holding SHIFT isShiftDown returns true (rigth. i was expecting that), but now seems that modifiers are also changed and the comparison with BUTTON1_DOWN_MASK fails.</p>
  
  <pre><code>me.getModifiers == InputEvent.BUTTON1_DOWN_MASK //failed..modifiers are changed
  </code></pre>
  
  <p>What am I doing wrong? How can I fix my code?</p>