how to select one cell from SWT table

Viewed 10618
table.addSelectionListener(new SelectionAdapter() 
        {
            public void widgetSelected(SelectionEvent e) 
            {
                if(table.getSelectionIndex() != -1)
                {
                    System.out.println(table.getSelectionIndex());
                    TableItem item = table.getItem(table.getSelectionIndex());
                    System.out.println(item.toString());
                }
                else
                {}
            }
        });

when i click on any cell in my table, only the first cell of that row is selected and returned and not exactly that cell

please tell me how can i select and get item from exactly that cell which i select

please see the image enter image description here

i have selected 3rd column but it returned the TableItem of first column

2 Answers
Related