大哥们帮帮怎么文本框不显示
菜鸟一个 那位大哥帮帮忙?
package oneswt;
import java.awt.Button;
import java.awt.Composite;
import java.awt.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.layout.RowLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class SimpleForm {
public static void main(String [] args){
Display display =new Display();
Shell shell=new Shell(display);
shell.setText("窗口");
shell.setBounds(100, 100, 300, 250);
FormLayout layout=new FormLayout();
layout.marginHeight=100;
layout.marginWidth=100;
shell.setLayout(layout);
// Label hello=new Label();
Label hello = new Label(shell,SWT.CANCEL); 怎么老是提示没有创建方法吗,小弟那做错了呢。
hello.setText("ni hao ");
shell.pack();
shell.open();
while(!shell.isDisposed()){
if(!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
------解决方案--------------------只是创建了label,并没有add到shell中,肯定不会显示啊
------解决方案--------------------import java.awt.Button;
import java.awt.Composite;
import java.awt.Label;
你导错包了,swt的东西怎么出现awt了????