1
我想在我的GUI的第二列(任務名稱)中插入jface TreeViewer,但它與第一列(任務ID)合併。那麼我怎麼才能得到控制權將這個從一列轉移到第二列。如何在第二個或特定列中插入jface TreeViewer?
我想在我的GUI的第二列(任務名稱)中插入jface TreeViewer,但它與第一列(任務ID)合併。那麼我怎麼才能得到控制權將這個從一列轉移到第二列。如何在第二個或特定列中插入jface TreeViewer?
與GridLayout
實現這一目標最簡單的方法是插入虛擬Label
s表示佔用的空間 「在前面」 你TreeViewer
的:
public static void main(String[] args)
{
final Display display = new Display();
final Shell shell = new Shell(display);
shell.setText("StackOverflow");
shell.setLayout(new GridLayout(3, true));
/* Top row */
new Button(shell, SWT.PUSH).setText("Button");
new Label(shell, SWT.NONE);
new Label(shell, SWT.NONE);
/* Middle row */
new Label(shell, SWT.NONE);
new Button(shell, SWT.PUSH).setText("Button");
new Label(shell, SWT.NONE);
/* Bottom row */
new Label(shell, SWT.NONE);
new Label(shell, SWT.NONE);
new Button(shell, SWT.PUSH).setText("Button");
shell.pack();
shell.open();
while (!shell.isDisposed())
{
if (!display.readAndDispatch())
{
display.sleep();
}
}
display.dispose();
}
產生以下:
哪你使用的是佈局嗎? – Baz
我正在使用網格佈局 –