Vertical Scroll Bar for Eclipse GridData

I have the following java code in an eclipse application:

import org.eclipse.swt.layout.GridData; import org.eclipse.swt.widgets.List; import org.eclipse.swt.widgets.Composite; import org.eclipse.datatools.connectivity.oda.OdaException; public void setupList(Composite parent, List items) throws OdaException { GridData myGrid = new GridData(GridData.FILL_HORIZONTAL); List myList = new List(parent, SWT.V_SCROLL); myList.setLayoutData(myGrid); myList.setItems(items); } 

In my program, the number of elements exceeds the maximum height of the window, but the vertical scroll bar is not displayed.

I thought passing the SWT.V_SCROLL parameter to the list would create a vertical scrollbar, but that didn't work.

What am I missing so that the GridData list has a vertical scrollbar?

Thanks.

+3
source share
1 answer

I get it. The next line should have changed:

 GridData myGrid = new GridData(GridData.FILL_BOTH); // FILL_BOTH instead of FILL_HORIZONTAL 
+2
source

Source: https://habr.com/ru/post/1480961/


All Articles