Search code examples
javatreecursorswttreeviewer

How to set Cursor to a Particular Cell of a SWT Tree


I have a SWT Tree, and I want to set the cursor to a particular cell of that SWT Tree. I have access of TreeViewer.

The screenshot below shows the cursor at column 1. I did it manually, but I want to do it programatically.

enter image description here


Solution

  • Have a look at TreeViewer#editElement(Object element, int column).

    Where element is the model element and column the column in your table.

    The Javadoc states:

    Starts editing the given element at the given column index.