Im new to Java and trying to get my head around the various functions, my current headache is MouseListeners

I have a JTabbedPane with three tabs each holding (JScrollPane plus a JTable) I now need to detect which row of which tab is being clicked and Im hitting problems. 

Do I need to just put a single listener on the first pane and detect which tab has been selected? or do I put one on each JTable?

I tried the following code but for some reason when I run it it does error

```
standardTable.addMouseListener(new MouseAdapter() {
  @Override
  public void mouseClicked(MouseEvent e) {
    JTabbedPane aPane = (JTabbedPane)e.getComponent();
    if(e.getClickCount()==2) {
      detectMouseClickRow(aPane, e);
    } // do this if double click
    if(e.getClickCount()==1) {
      detectSingleClick(aPane, e);
    } // Do this if its a single click
  }
});

```

When I run the above Netbeans alerts me to a problem but doesnt list where, so I ignore it and it errors at detectMouseClickRow(aPane, e); or its single click variant

**ClassCastException: javax.swing.JTable cannot be cast to javax.swing.JTabbedPane**

I could do with pointers because I'm prolly getting it wrong here and this is not the best method to use?