public class WebWiewYahoo extends Application {
public static void main(String[] args) {
launch(args);
}
@Override
public void start(Stage stage) throws Exception {
VBox root = new VBox();
Button go = new Button("go");
final TextField address = new TextField("http://www.yahoo.com");
final WebView browser = new WebView();
final WebEngine webEngine = browser.getEngine();
HBox toolBar1 = new HBox();
toolBar1.setAlignment(Pos.TOP_LEFT);
toolBar1.getChildren().addAll(address, go);
// load the web page
webEngine.load("http://www.yahoo.com");
root.getChildren().add(toolBar1);
root.getChildren().add(browser);
Scene scene = new Scene(root);
stage.setScene(scene);
stage.show();
}
}
//我想在浏览器中操作链接。因此,即使在任何时候单击任何链接,我都可以将其重定向到 yahoo.com。请帮助。