package eclipseSwt.swt;
import java.awt.Label;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class EclipseSwt {
public static void main(String[] args){
Display display=new Display();
Shell shell=new Shell(display);
shell.setText("窗口");
shell.setBounds(200, 200, 500, 350);
FormLayout layout=new FormLayout();
layout.marginHeight=50;
layout.marginWidth=50;
shell.setLayout(layout);
Label helloLabel = new Label(shell,SWT.CENTER);
helloLabel.setText("你好,SWT");
shell.pack();
shell.open();
while(!shell.isDisposed()){
if(!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
}
为什么编译的时候总是说
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
The constructor Label(Shell, int) is undefined
at eclipseSwt.swt.EclipseSwt.main(EclipseSwt.java:19)
这是为什么啊??
慕丝7291255
婷婷同学_
30秒到达战场
呼啦一阵风