这是我的代码,它实际上为域完成了所有 GUI 工作(右侧包含在所附图片中)。在这个函数中,我正在做的是在“newTabFolder”上创建一个复合“测试”。然后我正在创建 ScrolledComposite “sc”,然后在其上创建一个复合“compositeInTab”,在将所有小部件放在“compositeInTab”上之后,我正在创建一个 TabItem 用于在其上放置复合“测试”。
public DomainUI(Composite composite, TabFolder newTabFolder, boolean comingFromSelf)
{
Composite test = new Composite(newTabFolder,SWT.NONE);
test.setLayout(new FillLayout());
ScrolledComposite sc = new ScrolledComposite(test, SWT.V_SCROLL|SWT.H_SCROLL);
final Composite compositeInTab = new Composite(sc, SWT.NONE);
sc.setExpandHorizontal(true);
sc.setExpandVertical(true);
sc.setMinHeight(compositeInTab.computeSize(SWT.DEFAULT, SWT.DEFAULT).y);
sc.setMinWidth(compositeInTab.computeSize(SWT.DEFAULT, SWT.DEFAULT).x);
sc.setContent(compositeInTab);
compositeInTab.setLayout(null);
sc.setAlwaysShowScrollBars(true);
/*HERE I AM CREATING LABELS AND TEXT FIELDS AND SETTING THEIR BOUNDS*/
systemCodeLabel = new Label(compositeInTab, 0);
systemCodeText = new Text(compositeInTab, SWT.BORDER);
systemCodeLabel.setText("System Code");
systemCodeLabel.setBounds(350, 60, 100, 15);
systemCodeText.setBounds(480, 60, 150, 17);
// CREATION OF LABELS AND TEXTFIELDS ENDED
// CREATION OF TABLE STARTS
myTable = new CreateTable(compositeInTab, 1);
myTable.setBounds(50, 230, 0, 0);
myTable.table.setSize(myTable.table.computeSize(570, 250));
//here i filled data in table
for(int i=0; i<myTable.table.getColumnCount(); i++)
{
myTable.table.getColumn(i).pack();
myTable.table.getColumn(i).setWidth(myTable.table.getColumn(i).getWidth()+10);
}
TabItem tabItem1 = new TabItem(newTabFolder, SWT.NONE);
tabItem1.setText("Domain");
tabItem1.setControl(test);
newTabFolder.setBounds(0, 0, 480, 300);
}