简体   繁体   中英

How to set JFace ListViewer size?

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.

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM