import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class Mb {
private static Display display;
private static Shell shell;
private static Composite composite;
public static void init(){
display = new Display();
shell = new Shell(display,SWT.SHELL_TRIM);
shell.setSize(215, 550);
shell.open();
}
public static void init_1(){
while(!shell.isDisposed())
{
if(!display.readAndDispatch())
display.sleep();
}
display.dispose();
} public static void 上(){
init();
Label label = new Label(shell,SWT.NO);
label.setText("aaa");
label.setBounds(0, 0, 100, 20);
init_1();
}
public static void 下(){
init();
Label label_1 = new Label(shell,SWT.NO);
label_1.setText("bb");
label_1.setBounds(0, 30, 100, 20);
init_1();
}
}
这是我写的方法public class mainT { /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}}
这是我写的主类;
问题是这样的 。我调用Mb.上();和Mb.下();想在同一个窗口上显示出来我写的两个方法,但是现在我写的两个方法中.调用这两个方法的时候,必须一个关闭一个窗口后才能显示第二个窗口,而不是在同一个窗口上显示.
我的问题要是解决了.我会把分马上就给.因为我在线等。
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import org.eclipse.swt.widgets.Shell;
public class Mb {
private static Display display;
private static Shell shell;
private static Composite composite;
public static void init(){
display = new Display();
shell = new Shell(display,SWT.SHELL_TRIM);
shell.setSize(215, 550);
shell.open();
}
public static void init_1(){
while(!shell.isDisposed())
{
if(!display.readAndDispatch())
display.sleep();
}
display.dispose();
} public static void 上(){
init();
Label label = new Label(shell,SWT.NO);
label.setText("aaa");
label.setBounds(0, 0, 100, 20);
init_1();
}
public static void 下(){
init();
Label label_1 = new Label(shell,SWT.NO);
label_1.setText("bb");
label_1.setBounds(0, 30, 100, 20);
init_1();
}
}
这是我写的方法public class mainT { /**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
}}
这是我写的主类;
问题是这样的 。我调用Mb.上();和Mb.下();想在同一个窗口上显示出来我写的两个方法,但是现在我写的两个方法中.调用这两个方法的时候,必须一个关闭一个窗口后才能显示第二个窗口,而不是在同一个窗口上显示.
我的问题要是解决了.我会把分马上就给.因为我在线等。
解决方案 »
- httpClient 在执行命令的时候会产生很多输出,如何禁止?
- 求大神帮我看看这个DEMO的createCircle方法,怎么返回圆的点阵的
- 用ant编译时提示jar包提示不存在
- 如何固定jface中的Table组件的checkbox?
- Socket的问题
- 接口Connection怎么实例化呢?
- 请问,如果连接一个Mssql的数据库。并操作里面的数据。谢谢了:)
- 谁有“计算器”的源码呀!最好是手写的非ide编写的!谢谢
- 请问,关于super
- 用select count(*) from xxx;在SQLPLUS查询返回2,可用rs.getInt(1)返回竟然是0!!!
- 关于反射的问题
- 求SWT页面跳转的实例代码
你需要一个异步消息处理来完成你的工作。