title: Java jTable MouseListener not working
body: <p>I have problem with my mouselistener on jTable. 
  This is my code:</p>
  
  <pre><code> final JTable jTable1 = new JTable(tablemodel);
          JScrollPane scroll = new JScrollPane(jTable1);
  
          jTable1.addMouseListener(new MouseAdapter(){
              public void mouseClicked(Event e){
                  System.out.println("clicekd on table");
              }
          });
  </code></pre>
  
  <p>But this code not working, When I click on the cell data from the sysout does not show up.
  Eclipse tells me: The method <code>mouseClicked(Event)</code> from the type new <code>MouseAdapter(){}</code> is never used locally</p>
  
  <p>Edit:
  This is my function, everything works well except <code>jTable.addMouseListener</code></p>
  
  <pre><code>public void categoryShow() {
          // TODO Auto-generated method stub
          appListener.getCategory();
          List&lt;Category&gt; people = model.getPeople();
  
          DefaultTableModel tablemodel;
  
          tablemodel = new DefaultTableModel();
          final JTable jTable1 = new JTable(tablemodel);
          JScrollPane scroll = new JScrollPane(jTable1);
  
          jTable1.addMouseListener(new MouseAdapter(){
              @Override
              public void mouseClicked(MouseEvent e){
                  System.out.println("clicekd on table");
              }
          });
  
          tablemodel.addColumn("ID");
          tablemodel.addColumn("Nazwa");
  
          for (Category person : people) {
  
              tablemodel.addRow(new Object[]{person.getId(),person.getName()});
  
          }
          JPanel controls = new JPanel(new BorderLayout(5,5));
          JPanel buttons = new JPanel(new GridLayout(0,1,4,4));
  
          JButton deletebutton  = new JButton("Usuń");
          JButton newrow = new JButton("Dodaj");
          JButton print = new JButton("Drukuj");
  
          print.addActionListener(new ActionListener(){
              public void actionPerformed(ActionEvent arg0) {
                  // TODO Auto-generated method stub
                  try{
                      jTable1.print();
                  }catch (PrinterException pe){
                      System.err.println("Blad przy drukowaniu");
                  }   
              }           
          }); 
          jTable1.getModel().addTableModelListener(new TableModelListener(){
              public void tableChanged(TableModelEvent e){
                  // TODO Auto-generated method stub
                      if(jTable1.getCellEditor() != null){
                      int col = jTable1.getSelectedColumn();
                      String columnname = jTable1.getColumnName(col); 
                      System.out.println(jTable1.getSelectedColumn());
                      System.out.println("--" + columnname);  
                      System.out.println(jTable1.getValueAt(jTable1.getSelectedRow(),jTable1.getSelectedColumn())); //nowa wartosc
                      System.out.println(jTable1.getValueAt(jTable1.getSelectedRow(), 0)); //id
                  }
              }
          });
          newrow.addActionListener(new ActionListener(){
  
              public void actionPerformed(ActionEvent e){
  
                  final JFrame bankTeller = new JFrame("Dodaj nową kategorie");
                  bankTeller.setSize(500, 280);
                  bankTeller.setLocationRelativeTo(null);
                  bankTeller.setResizable(false);
                  bankTeller.setLayout(new GridBagLayout());
  
                  bankTeller.setBackground(Color.gray);
                  //bankTeller.getContentPane().add(everything, BorderLayout.CENTER);
  
                  GridBagConstraints c = new GridBagConstraints();
  
                  JPanel acctInfo = new JPanel(new GridBagLayout());
                  c.gridx = 0;
                  c.gridy = 0;
                  c.gridwidth = 2;
                  c.gridheight = 1;
                  c.insets = new Insets(5,5,5,5);
                  bankTeller.add(acctInfo, c);
                  c.gridwidth = 1;
  
                  JLabel custNameLbl = new JLabel("Nazwa kategorii");
                  c.gridx = 0;
                  c.gridy = 0;
                  c.insets = new Insets(0,0,0,0);
                  acctInfo.add(custNameLbl, c);
                  c.weightx=1.;
  
                  c.fill=GridBagConstraints.HORIZONTAL;
                  custNameTxt = new JTextField("",1000);
                  c.gridx = 1;
                  c.gridy = 0;
                  c.insets = new Insets(5,5,5,5);
                  acctInfo.add(custNameTxt,c);
  
                  closeBtn = new JButton("Anuluj");
                  c.gridx = 0;
                  c.gridy = 3;
                  c.insets = new Insets(5,5,5,5);
                  acctInfo.add(closeBtn,c);
  
                  savingsBtn = new JButton("Dodaj");
                  c.gridx = 1;
                  c.gridy = 3;
                  c.insets = new Insets(5,5,5,5);
                  acctInfo.add(savingsBtn,c);
  
                  bankTeller.setVisible(true);
  
                 closeBtn.addActionListener(new ActionListener(){
                     public void actionPerformed(ActionEvent e){
                         bankTeller.dispose();
                     }
                 }); 
  
                 savingsBtn.addActionListener(new ActionListener(){
  
                 public void actionPerformed(ActionEvent e){
  
                         String name = custNameTxt.getText();    
                         if(!name.isEmpty()){
                             fireCategoryEvent(new CreateCategoryEvent(name));
                         }else{
                          //   showMessageDialog(this, "Uzupełnij pole nazwa", "Error", JOptionPane.WARNING_MESSAGE);
                         }   
                  } 
                });
              }
          });
          deletebutton.addActionListener(new ActionListener() {
  
              public void actionPerformed(ActionEvent e) {
                  int selRow = (Integer) jTable1.getValueAt(jTable1.getSelectedRow(), 0);
  
                  if(selRow &gt;= 0) {
                      System.out.println(selRow);
                  }
              }
          });     
  
          buttons.add(newrow);
          buttons.add(deletebutton);
          buttons.add(print);
          buttons.setBorder(new TitledBorder("Zarządzaj"));
  
          controls.add(buttons,BorderLayout.NORTH);
  
          card1.add(scroll);
          card1.add(controls);
      } 
  </code></pre>