title: ActionEvent and MouseEvent right-click JAVA Mac
body: <p>I'm not sure if this a Mac issue, or an issue with my code. I am creating a grid of buttons. For each button I use ActionEvent for a regular click, and MouseEvent for a right click. What happens is when I CTRL-click the mouse event performs fine, however the action even also fires. Is there a way I can get around this while also using both action and mouse events? Relevant code:</p>
  
  <p>View Constructor:</p>
  
  <pre><code>for (int i = 0; i &lt; rows; i++)
          {
              for (int j = 0; j &lt; columns; j++)
              {
                  button[i][j] = new Cell();
                  button[i][j].addActionListener( new changeButtonHandler() );
                  button[i][j].addMouseListener( new handleRight() );
                  playArea.add(button[i][j]);
  
              }
          }
  </code></pre>
  
  <p>Action Event Class:</p>
  
  <pre><code>public class changeButtonHandler implements ActionListener
      {
          /**
           * Action performed after button is clicked
           * 
           */
          @SuppressWarnings("unchecked")
          public void actionPerformed(ActionEvent e)
          {
  
              for (int i = 0; i &lt; rows; i++)
              {
                  for (int j = 0; j &lt; columns; j++)
                  {
                      if (button[i][j] == e.getSource())
                      {   
                      //do stuff
                          }
                          else if(button[i][j].mine==false){
                              //do other stuff
                          }   
                      }
  
                  }
              }   
          }   
      }//end changeButtonHandler class
  </code></pre>
  
  <p>Mouse Event Class</p>
  
  <pre><code>public class handleRight implements MouseListener {
  
             /**
               * Action performed after button is right-clicked
               * 
               */
          public void mouseClicked(MouseEvent e)
          {
              if (SwingUtilities.isRightMouseButton(e) || e.isControlDown())      {
                  System.out.println("Right Worked");
                  for (int i = 0; i &lt; rows; i++)
                  {
                      for (int j = 0; j &lt; columns; j++)
                      {
                          if (button[i][j] == e.getSource())
                          {   
                                    //do stuff
                          }
                      }
                  }
              }
          }
  </code></pre>