0
我想爲Eclipse編輯器設計一個窗體並運行幾個問題。表格和兩個按鈕的Eclipse佈局
這個想法是有一個頁面,其中包含2個部分 - 左手部分包含一個表和兩個按鈕。該表應該與該部分的頂部對齊並向右擴展至底部。我希望按鈕位於表格右側,每個按鈕位於另一個下方,並讓它們與桌面頂部對齊。
有沒有人知道我需要做什麼GridLayouts的設置?我嘗試了所有我能想到的運氣組合。
離我最近的第二個按鈕位於頁面底部。
這裏是我的代碼的摘錄至今: -
Section section = toolkit.createSection(sashForm, ExpandableComposite.TITLE_BAR | ExpandableComposite.EXPANDED | ExpandableComposite.NO_TITLE_FOCUS_BOX);
section.setText("All Items");
Composite client = toolkit.createComposite(section);
section.setClient(client);
client.setLayout(new GridLayout(2, false));
Table table = toolkit.createTable(client, SWT.NULL);
table.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
TableViewer viewer = new TableViewer(table);
Button addButton = toolkit.createButton(client, "Add", SWT.PUSH);
addButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
Button removeButton = toolkit.createButton(client, "Remove", SWT.PUSH);
removeButton.setLayoutData(new GridData(GridData.FILL_HORIZONTAL | GridData.VERTICAL_ALIGN_BEGINNING));
這就是傢伙!我知道這很簡單,謝謝。 – bodger