コード例 #1
0
 /**
  * Create this dialog's drop-down list component.
  *
  * @param parent the parent composite
  * @return the drop-down list component
  */
 protected void createDropDownText(Composite parent) {
   // create the list
   text = new Text(parent, SWT.BORDER | SWT.H_SCROLL | SWT.V_SCROLL);
   // print the stacktrace in the text field
   try {
     ByteArrayOutputStream baos = new ByteArrayOutputStream();
     PrintStream ps = new PrintStream(baos);
     detail.printStackTrace(ps);
     if ((detail instanceof SWTError) && (((SWTError) detail).throwable != null)) {
       ps.println("\n*** Stack trace of contained exception ***"); // $NON-NLS-1$
       ((SWTError) detail).throwable.printStackTrace(ps);
     } else if ((detail instanceof SWTException) && (((SWTException) detail).throwable != null)) {
       ps.println("\n*** Stack trace of contained exception ***"); // $NON-NLS-1$
       ((SWTException) detail).throwable.printStackTrace(ps);
     }
     ps.flush();
     baos.flush();
     text.setText(baos.toString());
   } catch (IOException e) {
   }
   GridData data =
       new GridData(
           GridData.HORIZONTAL_ALIGN_FILL
               | GridData.GRAB_HORIZONTAL
               | GridData.VERTICAL_ALIGN_FILL
               | GridData.GRAB_VERTICAL);
   data.heightHint = text.getLineHeight() * TEXT_LINE_COUNT;
   text.setLayoutData(data);
 }
コード例 #2
0
ファイル: RecoverData.java プロジェクト: dewmal/ANDROPHSY
  private void showPic(String path) {
    FileInputStream fin;
    try {
      fin = new FileInputStream(path);
      Image image = new Image(Display.getCurrent(), fin);

      label.setText("test");
      label.setImage(image);
    } catch (FileNotFoundException e) {
      e.printStackTrace();
    } catch (SWTException e) {
      e.printStackTrace();
      label.setText("Unable to load Image");
    }
  }