2

我有一个TableViewerRCPview应用程序。有TableViewer一个Listofobjects作为输入。是否可以selection使用我设置为输入的列表中对象的索引为特定对象创建一个TableViewer?例如,我想在每次打开应用程序时为第三个对象设置默认选择。如何设置该选择?

4

1 回答 1

10

找到了答案!

int selection = 5; //row we want to select
tableViewer.setSelection(new StructuredSelection(tableViewer.getElementAt(selection)),true);

感谢http://andy.ekiwi.de/?p=1040

于 2012-10-15T10:55:27.180 回答