How to set JFace ListViewer size?
Question
OK - I give up.
How can I set width and height of a JFace ListViewer?
This should be self-evident but can't seem to find anything and there's no obvious way of doing it looking at the methods of the class.
Tried this with no luck:
myListViewer.getControl().setSize(1000, 1000);
Any help appreciated.
Solution
You don't set the size explicitly. you use layouts instead. Layouts manage the size and position of your widgets in a container. Read this eclipse article that will help you understand SWT layouts.
OTHER TIPS
To do this you can set a layoutdata to your List associated with the ListViewer
myListViewer.getControl().setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
to resize the control to fill the cell horizontally and to fit the remaining horizontal space.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow