[请教达人]用AWT写的源码,在此基础上用能SWT继续开发吗 已有源码是用AWT写的,现在要做扩充,GUI程序,能够同时让AWT和SWT做的界面运行吗.比如主界面是基于AWT写的,点击一个按钮,出来一个基于SWT的对话框,可以吗?请教达人! 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 如果能把主界面的JDialog改成shell的话可以利用Frame frame = SWT_AWT.new_Frame(composite);生成一个frame ,把原来的东西全部迁移到这个frame 上的话就可以做final Frame frame = SWT_AWT.new_Frame(composite); final JButton button_1 = new JButton(); button_1.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent arg0) { Display.getDefault().asyncExec(new Runnable(){ @Override public void run() { Shell shell = new Shell(Display.getDefault(), SWT.NONE); shell.setText("SWT Application"); shell.setSize(500, 375); shell.open(); shell.layout(); }}); } });这个是可以打开一个新的shell,但是如果不能改我是了一下final JButton button = new JButton(); button.addActionListener(new ActionListener() { public void actionPerformed(final ActionEvent e) { final Display display = Display.getDefault(); Display.getDefault().asyncExec(new Runnable(){ @Override public void run() { Shell shell = new Shell(display, SWT.NONE); shell.setText("SWT Application"); shell.setSize(500, 375); shell.open(); shell.layout(); }}); } });是打不开的,点了没反应,可能是方法有问题也可能是本身就不能实现,仅作参考 Calendar日期设置问题? 找不到符号、 IOException cannot be resolved to a type 如何判断ftp上的文件是目录还是文件? 关于jpeg图片分割问题 如何用IO对一个txt文本内容进行删除操作 初学java 请多指点... 哪儿可以下载到Linux下的J2sdk1.4.0版? 有什么网站有提供Java编程的例子的啊!我是一个初学者,最好是由浅入深! 求一个正则表达式--java--急急急 请问如何进行Java2D深入研究 请问如何用JTree实现以下效果?
final Frame frame = SWT_AWT.new_Frame(composite); final JButton button_1 = new JButton();
button_1.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent arg0) {
Display.getDefault().asyncExec(new Runnable(){ @Override
public void run() {
Shell shell = new Shell(Display.getDefault(), SWT.NONE);
shell.setText("SWT Application");
shell.setSize(500, 375);
shell.open();
shell.layout();
}});
}
});
这个是可以打开一个新的shell,但是如果不能改我是了一下
final JButton button = new JButton();
button.addActionListener(new ActionListener() {
public void actionPerformed(final ActionEvent e) {
final Display display = Display.getDefault();
Display.getDefault().asyncExec(new Runnable(){ @Override
public void run() {
Shell shell = new Shell(display, SWT.NONE);
shell.setText("SWT Application");
shell.setSize(500, 375);
shell.open();
shell.layout();
}});
}
});
是打不开的,点了没反应,可能是方法有问题也可能是本身就不能实现,仅作参考