Java swt
来源:百度知道 编辑:UC知道 时间:2024/05/20 05:45:05
就是说点一个按钮弹出另一个窗口。
我用NEW 的方法不行,不知道那个高手能给我一个例子
我好好感谢的。
文件一:
public class ChildShellExample {
@SuppressWarnings("unused")
ChildShellExample() {
Display d = new Display();
final Shell s = new Shell(d);
s.setSize(500, 500);
Button button = new Button(s, SWT.NONE);
button.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
ChildShell cs = new ChildShell(s);
}
});
button.setBounds(163, 204, 68, 23);
button.setText("打开");
// s.setMaximized(false);
s.open();
while (!s.isDisposed()) {
if (!d.readAndDispatch())
d.sleep();
}
d.dispose();
}
public static void main(String[] args) {
new ChildShellExample();
}
}
文件二:
import org.e