title: JFrame - mouse click using JComponent and MouseListener
body: <p>Having 2 classes  - </p>
  
  <pre><code>public class MainClass {
  
  
  
    public static void main(String[] args)  {
      JFrame frame = new JFrame();
      ....
      Component mouseClick = new MyComponent()  ; 
      frame.setVisible(true);
  }
  
  public class MyComponent extends JComponent implements MouseListener {
  
      @Override
      public void mouseClicked(MouseEvent arg0) {
          System.out.println("here was a click ! ");
  
      }
      ...
  
  }
  </code></pre>
  
  <p>I trying to set on the <code>frame</code> a listener for mouse click  , but when I run it and then press mouse click nothing happens  . </p>
  
  <p>How to make it work  ? </p>