I have a cell in JTable where a JPanel has located in it. JPanel has 2 labels inside it. I want to do different action when left label is clicked, and I want to make another operation when right action is clicked. I do not want to use TableCellEditor, it makes my code so complicated. Becase my cell values has a range of type.
I write following code to get selected component from mouse event, but with no success. I tried also SwingUtilies.convertMouseEvent, but it did not change anything. What is the problem with below code? Why JComponent contains method does not check mouse point.
contSimTable.addMouseListener(new MouseAdapter() {
    public void mouseClicked(final MouseEvent event) {
        if (SwingUtilities.isLeftMouseButton(event)) {
            if (event.getClickCount() == 2) {
                JTable target = (JTable) event.getSource();
                int row = contSimTable.getSelectedRow();
                int column = contSimTable.getSelectedColumn();
                /**
                 * convert from view colum to model.It is column index
                 * which is stored in table model
                 */
                int modelColumn = target.convertColumnIndexToModel(column);
                Object clickedCell = contSimTable.getValueAt(row, modelColumn);
                if (clickedCell instanceof JPanel) {
                    boolean isSecond = false;
                    JLabel a = (JLabel) ((JPanel) clickedCell)
                        .getComponent(0);
                    JLabel b = (JLabel) ((JPanel) clickedCell)
                        .getComponent(1);
                    if (a.contains(event.getPoint())) {
                        isSecond = false;
                    }
                    //                                                      
                    if (b.contains(event.getPoint())) {
                        isSecond = true;
                    }
                }
            }
        }
    }
});