以为setText()可以解决   谁知继承自jface的dialog没有这个方法   哎 各位用过的说说怎么设置哈  不胜感激

解决方案 »

  1.   

    LZ参考一下下面的代码:
    import   org.eclipse.jface.action.MenuManager;   
      import   org.eclipse.jface.dialogs.Dialog;   
      import   org.eclipse.swt.SWT;   
      import   org.eclipse.swt.layout.GridData;   
      import   org.eclipse.swt.layout.GridLayout;   
      import   org.eclipse.swt.widgets.*;   
        
        
        
      public   class   PurposeConfiger   extends   Dialog   {   
              private   Shell   shell   =   null;   
              private   Text   text   =   null;   /****   其实我是想让这个文本框显示多行   ****/   
                
              public   PurposeConfiger(Shell   parentShell)   {   
                      super(parentShell);   
              }   
        
        
              protected   Control   createDialogArea(Composite   parent)   {   
                      Shell   shell   =   this.getShell();   
                      shell.setText("配置[用途]预制信息");   
                      shell.setStze(300,300);   /***   次语句后的所有要添加的组件都不添加了   ****//   
                        
                      GridLayout   gridLayout   =   new   GridLayout();   
                      gridLayout.numColumns   =   1;   
                      gridLayout.horizontalSpacing   =   10;   
                      gridLayout.marginHeight   =   5;   
                      gridLayout.marginWidth   =   5;   
                      gridLayout.makeColumnsEqualWidth   =   true;   
                      parent.setLayout(gridLayout);   
                      {   
                              Label   inf   =   new   Label(parent,   SWT.NONE);   
                              inf.setText("预制用途信息,每行一个");   
                              GridData   gridData   =   new   GridData(GridData.FILL_HORIZONTAL);   
                              gridData.horizontalSpan   =   1;   
                              inf.setLayoutData(gridData);   
                      }   
                      {   
                              Text   text   =   new   Text(parent,   SWT.BORDER   |   SWT.MULTI   |   SWT.V_SCROLL);   
                              GridData   gridData   =   new   GridData(GridData.FILL_HORIZONTAL   
                                                                                            |   GridData.FILL_VERTICAL);   
                              gridData.horizontalSpan   =   1;   
                              gridData.verticalSpan   =   5;   
                              text.setLayoutData(gridData);   
                      }   
                      return   parent;   
              }   
                
              protected   int   getShellStyle()   {   
                      return   super.getShellStyle()   |   SWT.RESIZE;   
              }   
      }