title: In Java how to get name of component which is clicked
body: <p>I want to know the name of the component which is clicked, for that I am doing something like this:</p>
  
  <pre><code>@Override
      public void mouseClicked(MouseEvent clicked) {
          if( clicked.getSource() instanceof JLabel )
              System.out.println( clicked.getComponent().getName() );
      }
  </code></pre>
  
  <p>but this is returning "null", please tell how can I get the component's name which is clicked?</p>