OutBrowser.java
Go to the documentation of this file.00001 package edu.rice.cs.hpc.viewer.help;
00002
00003 import org.eclipse.swt.SWT;
00004 import org.eclipse.swt.browser.Browser;
00005 import org.eclipse.swt.layout.GridData;
00006 import org.eclipse.swt.layout.GridLayout;
00007 import org.eclipse.swt.widgets.Display;
00008 import org.eclipse.swt.widgets.FileDialog;
00009 import org.eclipse.swt.widgets.Shell;
00010
00011 public class OutBrowser {
00012
00016 public static void main(String[] args) {
00017 Shell shell = new Shell(SWT.SHELL_TRIM);
00018 shell.setLayout(new GridLayout(1, true));
00019
00020 final Browser browser = new Browser(shell, SWT.BORDER );
00021 GridData gridData1 = new GridData(GridData.FILL_BOTH);
00022 gridData1.horizontalSpan = 1;
00023 gridData1.minimumWidth = 200;
00024 gridData1.minimumHeight = 400;
00025 browser.setLayoutData(gridData1);
00026
00027 FileDialog objFileDlg = new FileDialog(shell);
00028 String sFile = objFileDlg.open();
00029 browser.setUrl(sFile);
00030 System.out.println("File: "+sFile);
00031
00032 Display display = shell.getDisplay();
00033 shell.pack();
00034 shell.open();
00035 while (!shell.isDisposed())
00036 if (!display.readAndDispatch())
00037 display.sleep();
00038 }
00039
00040 }