[英]SWT / JFace Scrollview not scrolling
我有兩個選項卡,分別具有各自的視圖。 tabview本身在滾動視圖中。 由於某些原因,較大的選項卡不會顯示滾動條。 我像這樣設置(工作)tabview:
public CustomerTab(Composite arg1, int arg2) throws SQLException {
super(arg1, arg2);
layout = new org.eclipse.swt.layout.GridLayout(GridData.FILL_BOTH, false);
layout.numColumns = 1;
this.setLayout(layout);
不會導致滾動條出現的那個開始像這樣:
public InvoiceTab(Composite parent, int arg2) throws Exception {
super(parent, arg2);
// new gridlayout and asign to this tab
gridLayout = new org.eclipse.swt.layout.GridLayout(GridData.FILL_BOTH, false);
gridLayout.numColumns = 3;
this.setLayout(gridLayout);
在我的應用程序中,我配置外殼程序:
@Override protected void configureShell(Shell shell) {
super.configureShell(shell);
shell.setSize(1130, 530);
setShellStyle(SWT.SHELL_TRIM & (~SWT.RESIZE));
}
並以這種方式創建scrollview:
@Override protected Control createContents (Composite parent) {
scrolledComp = new ScrolledComposite(parent, SWT.H_SCROLL | SWT.V_SCROLL);
mainContent = new Composite(scrolledComp, SWT.NONE);
mainContent.setLayout(new FillLayout());
mainTabView = null;
mainTabView = new MainTabView(mainContent);
scrolledComp.setContent(mainContent);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setMinSize(1100, 500);
return mainTabView;
}
發生的情況是,滾動視圖僅顯示500的行程,但下面沒有內容,沒有滾動條。 有人可以看到我在做什么錯嗎?
提前感謝,馬庫斯
由於您將最小高度手動設置為500,因此ScrolledComposite
不會更好。
您應使用內容的“實際”大小作為最小大小。 您可以使用以下代碼:
scrolledComp.setContent(mainContent);
scrolledComp.setExpandHorizontal(true);
scrolledComp.setExpandVertical(true);
scrolledComp.setMinSize(mainContent.computeSize(SWT.DEFAULT, SWT.DEFAULT));
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.