swtdemo2

//生成一个简单的父面板
    private Composite createOtherComp(Composite rightComp) {
        Composite composite = new Composite(rightComp, SWT.NONE);
        composite.setLayout(new FillLayout());
        composite.setBackgroundImage(new Image(display, "D:\\test.png"));
        return composite;
    }
   
   
   
    //生成一个简单的子面板
    private Composite createYourDataComp(Composite rightComp) {
        Composite composite = new Composite(rightComp, SWT.NONE);
        composite.setLayout(new GridLayout(6, false));//个人资料面板分成6列

     
        new Label(composite, SWT.NONE).setText("Name:");
        //只读型的文本框
        Text text = new Text(composite,  SWT.BORDER| SWT.WRAP);
        //水平抢占式充满,并占用三列的空间. createGridData是自定义方法
        text.setLayoutData(createGridData(GridData.FILL_HORIZONTAL, 5));       
        //这里建立多个选项
        Composite selectComp = new Composite(composite, SWT.BORDER| SWT.WRAP);
        GridData gridData = new GridData(GridData. FILL_HORIZONTAL  );
    
      
        //Composite默认的高度太高,故手工设定高度为20像素
        gridData.heightHint = 20;
        selectComp.setLayoutData(createGridData(GridData.FILL_VERTICAL|GridData.FILL_HORIZONTAL , 5));
        Button applay=new Button(selectComp,SWT.None);
        applay.setText("Apply");
        applay.setBounds(450, 425, 88, 26);
        Button revert=new Button(selectComp,SWT.None);
        revert.setText("revert");
        revert.setBounds(545, 425, 88, 26);
       
    TabFolder tabFolder=new TabFolder(selectComp,SWT.NONE);
tabFolder.setBounds(0,0,670,420);//必须得要
TabItem tabItem1=new TabItem(tabFolder,SWT.NONE);//声明第1个选项页
tabItem1.setText("Main");

TabItem tabItem2=new TabItem(tabFolder,SWT.NONE);//声明第2个选项页
tabItem2.setText("Argument");

TabItem tabItemJRE=new TabItem(tabFolder,SWT.NONE);//声明第3个选项页
tabItemJRE.setText("JRE");

TabItem tabItemClassPath=new TabItem(tabFolder,SWT.NONE);//声明第4个选项页
tabItemClassPath.setText("Class Path");

TabItem tabItemSource=new TabItem(tabFolder,SWT.NONE);//声明第5个选项页
tabItemSource.setText("Source");

TabItem tabItemEnvironment=new TabItem(tabFolder,SWT.NONE);//声明第5个选项页
tabItemEnvironment.setText("Environment");

TabItem tabItemCommon=new TabItem(tabFolder,SWT.NONE);//声明第5个选项页
tabItemCommon.setText("Common");


//第一选项Main
Group group1=new Group(tabFolder,SWT.None);
group1.setSize(850, 60);
tabItem1.setControl(group1);
Group projectGroup=GroupExample.getProjectGroup(group1, SWT.SHADOW_ETCHED_IN, "Project");
projectGroup.setLocation(10,20);
Group classGroup=GroupExample.getClassGroup(group1, SWT.SHADOW_ETCHED_IN, "Main Class");    
classGroup.setLocation(10,96);

      //第二参数选项
Group group2=new Group(tabFolder,SWT.None);
group2.setSize(850, 60);
tabItem2.setControl(group2);
Group argumentProgram=GroupExample.getArgumentVM(group2, SWT.SHADOW_ETCHED_IN, "Program Argument");
argumentProgram.setLocation(10,20);
Group argumentVM=GroupExample.getArgumentVM(group2, SWT.SHADOW_ETCHED_IN, "VM Argument");
argumentVM.setLocation(10,148);
Group argumentDirectory=GroupExample.getArgumentDirectory(group2, SWT.SHADOW_ETCHED_IN, "VM Argument");
argumentDirectory.setLocation(10,275);




        //返回个人资料面板composite
        return composite;
    }
   

你可能感兴趣的:(demo)