title: How to add listener event to JComboBox in Java
body: <p>I need to know how to effectively add a mouse event to a JComboBox or any other approach that works. I found some possible solutions here and also different sites but I can't get it to work. It seems that mouseEvent is not appropriate to use on JComboBox as it is a compound component. I found a possible solution for a compound component but also doesn't work. So below is my code that works when I use a text field. Any ideas of which approach should I use? Thanks</p>
  
  <pre><code>    private void updateReviewers() {
          jComboBox_reviewer.addMouseListener(new MouseListener() {
  
          @Override
          public void mouseClicked(MouseEvent e) {
              System.out.println("clicked");
          }
  
          @Override
          public void mousePressed(MouseEvent e) {
              System.out.println("pressed");
          }
  
          @Override
          public void mouseReleased(MouseEvent e) {
              System.out.println("released");
          }
  
          @Override
          public void mouseEntered(MouseEvent e) {
              System.out.println("entered");
          }
  
          @Override
          public void mouseExited(MouseEvent e) {
              System.out.println("exited");
          }
  
      }
      );
  
  }
  </code></pre>