public static void main(String[] args) throws Exception{
Display display=new Display();
Shell shell=new Shell(display,SWT.SHELL_TRIM);
RowLayout layout=new RowLayout(SWT.VERTICAL);
shell.setLayout(layout);
shell.setText("下拉框和按钮");
Button checkbox=new Button(shell,SWT.CHECK);
checkbox.setText("SWT.CHECK");
Combo radio=new Combo(shell,SWT.ABORT);
radio.add("SWT 12");
radio.add("S");
radio.add("123");
shell.pack();
shell.open();
while(!shell.isDisposed()){
if(!display.readAndDispatch()){
display.sleep();
}
}
display.dispose();
}
转载:https://blog.youkuaiyun.com/jayliu/article/details/373596
本文展示了一个使用SWT库创建GUI界面的Java代码示例,包括一个带有下拉菜单和复选框按钮的窗口。通过具体代码实现了窗口布局、组件添加及界面显示。
89

被折叠的 条评论
为什么被折叠?



