import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;public class Inside extends SelectionAdapter{
public static void main(String[] args) {
// Display负责管理事件循环和控制UI线程和其他线程之间的通信
final Display display = Display.getDefault();
final Shell shell = new Shell(); // shell是程序的主窗口
//shell.setSize(327, 253); // 设置主窗口的大小
shell.setSize(400, 400); 
shell.setText("Hello World"); // 设置主窗口的标题
// ---------创建窗口中的其他界面组件-------------

Button button=new Button(shell,SWT.NONE);
button.setText("Hello Nancy");
button.setBounds(20,10,88,44);
/*
 * 
 button.addSelectionListener(new SelectionAdapter()
{
//public void widgetSeletcted(SelectionEvent e){
  public void widgetSelected(SelectionEvent e) {
MessageDialog.openInformation(shell,"hello","HelloWorld");
}
});
*/
button.addSelectionListener(new Inside());

// -----------------END------------------------
shell.layout(); // 应用界面布局
shell.open(); // 打开shell主窗口
while (!shell.isDisposed()) { // 如果主窗口没有关闭,则一直循环
//while (shell.isDisposed()) { 
if (!display.readAndDispatch()) // 如果display不忙,就让display处在休眠状态
display.sleep();
}
display.dispose();


}
//chongxie
public void widgetSelected(SelectionEvent e){
MessageDialog.openInformation(shell,"hello","HelloWorld");//就是这个shell报错说不能解析 }

}
为什么呢?shell都已定义成fianl了呀。望赐教。小妹初入茅庐,还不太懂java的规矩。