Java 在SWT中如何将组合划分为不同的空间

Java 在SWT中如何将组合划分为不同的空间,java,layout,swt,Java,Layout,Swt,我正在SWT中创建一个日志查看器,遇到了一个需要显示main文本和detailedText的问题。我希望主文本只有25%或可用空间,而detailText应该有75%的可用空间。所以我继续学习swt中的布局管理器。看起来SWT并没有为我提供任何相应的布局管理器。我目前使用的是FillLayout,它只是简单地将组合体放入相等的空间中。有什么办法可以根据我的方便来划分空间吗 public class LogViewer{ Text mainText; Text detailText; pub

我正在SWT中创建一个日志查看器,遇到了一个需要显示main文本和detailedText的问题。我希望主文本只有25%或可用空间,而detailText应该有75%的可用空间。所以我继续学习swt中的布局管理器。看起来SWT并没有为我提供任何相应的布局管理器。我目前使用的是
FillLayout
,它只是简单地将组合体放入相等的空间中。有什么办法可以根据我的方便来划分空间吗

public class LogViewer{
 Text mainText;
 Text detailText;
 public void initialize(Composite parent){
  parent.setLayout(new FillLayout(SWT.VERTICAL));
  mainText = new Text( parent, SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
  detailText = new Text( parent, SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
  mainText.setVisible( true );
  detailText.setVisible( true );
  mainText.setText("This is the error message");
  detailText.setText("This text is mulitline error text message")
 }
}
这就是信息的显示方式

这就是我想要的


有人能帮我并指引我正确的方向吗。提前感谢。

我真诚地感谢greg-449。他的评论使之成为可能。他建议我用它,效果很好。再次感谢你。这是我的更新代码

public class LogViewer{
 Text mainText;
 Text detailText;
 public void initialize(Composite parent){
  parent.setLayout(new FillLayout(SWT.VERTICAL));
  SashForm sashForm =new SashForm(parent, SWT.VERTICAL);
  mainText = new Text( sashForm , SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
  detailText = new Text( sashForm , SWT.WRAP | SWT.MULTI | SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL );
  mainText.setVisible( true );
  detailText.setVisible( true );
  sashForm.setWeights(new int[]{1,3});
  mainText.setText("This is the error message");
  detailText.setText("This text is mulitline error text message")
 }
}

看看如何使用
org.eclipse.swt.custom.SashForm
SashForm.setWeights
方法允许设置相对大小。@greg-449非常感谢您