日期:2014-05-20  浏览次数:20682 次

模拟书上做的QQ界面,怎么点击左边list没反应啊
package   cn.awt;

import   java.awt.event.MouseEvent;

import   org.eclipse.jface.dialogs.MessageDialog;
import   org.eclipse.swt.SWT;
import   org.eclipse.swt.custom.SashForm;
import   org.eclipse.swt.custom.StackLayout;
import   org.eclipse.swt.events.MouseAdapter;
import   org.eclipse.swt.events.SelectionAdapter;
import   org.eclipse.swt.events.SelectionEvent;
import   org.eclipse.swt.events.VerifyEvent;
import   org.eclipse.swt.events.VerifyListener;
import   org.eclipse.swt.layout.FillLayout;
import   org.eclipse.swt.layout.GridData;
import   org.eclipse.swt.layout.GridLayout;
import   org.eclipse.swt.layout.RowData;
import   org.eclipse.swt.layout.RowLayout;
import   org.eclipse.swt.widgets.Button;
import   org.eclipse.swt.widgets.Combo;
import   org.eclipse.swt.widgets.Composite;
import   org.eclipse.swt.widgets.Display;
import   org.eclipse.swt.widgets.Group;
import   org.eclipse.swt.widgets.Label;
import   org.eclipse.swt.widgets.List;
import   org.eclipse.swt.widgets.Shell;
import   org.eclipse.swt.widgets.Text;

import   cn.awt.*;

import   com.swtdesigner.SWTResourceManager;

public   class   QQ   {

private   static   Text   text_6;
private   static   Text   text_5;
private   static   Text   text_4;
private   static   Text   text_3;
private   static   Text   text_2;
private   static   Combo   combo;
private   static   Text   text_1;
private   static   Text   zursaText;
private   static   Text   text;
private   static   List   list;

/**
  *   Launch   the   application
  *   @param   args
  */
public   static   void   main(String[]   args)   {
final   Display   display   =   Display.getDefault();
final   Shell   shell   =   new   Shell();
final   GridLayout   gridLayout   =   new   GridLayout();
shell.setLayout(gridLayout);
shell.setSize(515,   399);
shell.setText( "QQ2007设置 ");
//

shell.open();

final   SashForm   sashForm   =   new   SashForm(shell,   SWT.BORDER);

final   Composite   leftComp   =   new   Composite(sashForm,   SWT.BORDER);
leftComp.setLayout(new   FillLayout());

final   List   list;
list   =   new   List(leftComp,   SWT.BORDER);
list.setItems(new   String[]{ "个人资料 ", "身份验证 "});
// list.add( "个人资料 ",0);
// list.add( "QQ秀 ",1);
// list.add( "3D秀 ",2);
// list.add( "联系方式 ",3);
// list.add( "身份验证 ",1);
// list.add( "状态显示 ",5);

GridData   gd1=new   GridData();
gd1.grabExcessHorizontalSpace=true;
gd1.grabExcessVerticalSpace=true;
sashForm.setLayoutData(gd1);

final   Composite   rightComp   =   new   Composite(sashForm,   SWT.BORDER);
final   StackLayout   stackLayout   =   new   StackLayout();
rightComp.setLayout(stackLayout);

final   Composite   myDateComp;
myDateComp   =   new   Composite(rightComp,   SWT.NONE);