当前位置:编程学习 > JAVA >>

菜鸟一枚,不能登录上网页,问题何在?

import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent;
//import org.eclipse.swt.events.SelectionEvent;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.widgets.*;
//import org.eclipse.jface.viewers.*;
public class helloWorld {
public static void main(String[] args) {
final Display display = new Display();
Shell shell = new Shell(display);
final Shell s = new Shell(display);
Text text = new Text(shell, SWT.NULL);
text.setBounds(20, 20, 230, 40);
Button okButton = new Button(shell, SWT.NULL);
okButton.setText("GO!");
okButton.setBounds(300,20,100,30);
s.setLayout(new FillLayout());
s.setSize(800, 600);
Browser browser = new Browser(s, SWT.NULL);
String urlStr = text.getText();
browser.setUrl(urlStr);
shell.pack();
shell.open();
okButton.addSelectionListener(new SelectionAdapter() {
public void widgetSelected(SelectionEvent e) {
s.open();
while (!s.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}

}
});
while (!s.isDisposed()) {
if (!display.readAndDispatch())
display.sleep();
}
display.dispose();
}
} --------------------编程问答-------------------- 这是一个神级问题 --------------------编程问答-------------------- 看不懂 --------------------编程问答--------------------
不懂 --------------------编程问答-------------------- mark,不懂这个。
召唤懂的人来看看这个,顺便学习下。
补充:Java ,  Eclipse
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,