title: Why Listeners are interdependent on one another in Java?
body: <p>I have written MineSweeper game. In that I have two Listeners for a button as, </p>
  
  <pre><code> class SampleClass extends MouseAdapter implements ActionListener  {
  
           //Some code here
  
            public void actionPerformed(ActionEvent event){ // Buttons listener..
                 System.out.println("I came here to actionPerformed.");
                 //Some Code
            }
  
           public void mouseClicked(MouseEvent event) { //Mouse listener..
                 System.out.println("I came here to MouseClicked.");
                //Some Code
                 if(event.getButton() == MouseEvent.BUTTON3){..}//If Right Mouse Button Is Clicked!!
                 else if(event.getButton() == MouseEvent.BUTTON1){..}//If Left Mouse Button Is Clicked!!
           }
   }
  </code></pre>
  
  <p>What I observed is , whenever <strong>left button of mouse is clicked, the only actionPerformed is called and not mouseClicked</strong>. But on the click of the right button of mouse, mouseClicked is called ( and as in normal case , actionPerformed is not called).</p>
  
  <p>But, <strong>When I remove the ActionListener</strong>, then on <strong>both clicks</strong> of left and right mouse buttons <strong>mouseClicked is called</strong> and works perfectly fine.</p>
  
  <p>I thought, the two listeners to be two different independent threads, listening for the events, <strong>But why one depends on other?</strong></p>