Eclipse GridData的垂直滚动条 [英] Vertical Scrollbar for Eclipse GridData

查看:157
本文介绍了Eclipse GridData的垂直滚动条的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

  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);
列出myList = new List(parent,SWT.V_SCROLL);
myList.setLayoutData(myGrid);
myList.setItems(items);

}

在我的程序中,项目数量超过最大高度的窗口,但没有垂直滚动条出现。



我以为将SWT.V_SCROLL参数传递给列表将创建一个垂直滚动条,但它没有起作用。



我没想到让GridData的列表有一个垂直滚动条?



谢谢。

解决方案

我想出来了。以下行需要更改:

  GridData myGrid = new GridData(GridData.FILL_BOTH); // FILL_BOTH而不是FILL_HORIZONTAL 


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 items exceeds the maximum height of the window, but no vertical scrollbar appears.

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

What am I missing to make the GridData's List have a vertical scrollbar?

Thanks.

解决方案

I figured it out. The following line needed to change:

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

这篇关于Eclipse GridData的垂直滚动条的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆