swt

public class SWTDemo {
StackLayout stackLayout = new StackLayout();
private Display display = new Display();
Shell shell = new Shell(display);
Composite yourDataComp;
Composite parentComp;
public SWTDemo() {
init();
}

private void init() {
shell.setText("swt demo");
shell.open();
getSashForm();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) {
display.sleep();
}
}
display.dispose();
}
public void getSashForm() {
SashForm sashForm = new SashForm(shell, SWT.VERTICAL);

Composite upComposite=new Composite(sashForm, SWT.BORDER);
upComposite.setBackgroundImage(new Image(shell.getDisplay(),"./icons/swtup.png"));

SashForm leftSashForm = new SashForm(sashForm, SWT.HORIZONTAL);
Composite downComposite=new Composite(sashForm,SWT.BORDER);
Button runButton=new Button(downComposite,SWT.None);
runButton.setText("Run");
runButton.setBounds(740, 20, 88, 26);

Button buttonClose=new Button(downComposite,SWT.None);
buttonClose.setText("close");
buttonClose.setBounds(830, 20, 88, 26);

sashForm.setWeights(new int[] { 1, 8,1}); //分成上一份 中 八分 下 一份
Composite composite = new Composite(leftSashForm, SWT.NONE);
Tree tree = LeftComposite.getScomposite(composite);
Composite rightComposite = new Composite(leftSashForm, SWT.BORDER);//右面板
rightComposite.setLayout(stackLayout);
sashForm.setLayout(stackLayout);
//共两页。将生成此面板的代码提出成一个方法,保证代码结构的清晰。
yourDataComp = createYourDataComp(rightComposite);//个人资料的面板
parentComp = createOtherComp(rightComposite);//eclipse 详细资料
//在堆栈面板上先显示“个人资料”界面
stackLayout.topControl = yourDataComp;
tree.addSelectionListener(new TreeSelect(tree, rightComposite,this));
leftSashForm.setWeights(new int[] { 1, 3 });
sashForm.setBounds(5, 5, 940, 630);
}
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值