swt c / s 인터페이스 에서 웹 페이지 열기
3608 단어 swt-html
`import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.TitleEvent;
import org.eclipse.swt.browser.TitleListener;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
public class Test1 {
static{
System.setProperty("org.eclipse.swt.browser.XULRunnerPath", "e:\\xulrunner");
}
public static void main(String[] args) {
Display display = new Display ();
final Shell shell = new Shell (display);
FillLayout layout = new FillLayout();
shell.setLayout(layout);
Browser browser = new Browser(shell, SWT.MOZILLA); //1
browser.addTitleListener(new TitleListener(){ //2
public void changed(TitleEvent event) {
shell.setText(event.title);
}
});
browser.setUrl("http://192.163.20.17:8080/20150509SSH_Study/index.jsp"); //3
shell.open ();
while (!shell.isDisposed ()) {
if (!display.readAndDispatch ()) display.sleep ();
}
display.dispose ();
}
}