List of usage examples for javafx.scene.web WebHistory go
public void go(int offset) throws IndexOutOfBoundsException
From source file:Main.java
@Override public void start(final Stage stage) { stage.setWidth(400);/*from w w w. j a v a 2 s. c om*/ stage.setHeight(500); Scene scene = new Scene(new Group()); final WebView browser = new WebView(); final WebEngine webEngine = browser.getEngine(); ScrollPane scrollPane = new ScrollPane(); scrollPane.setContent(browser); browser.getEngine().setOnAlert((WebEvent<String> wEvent) -> { System.out.println("Alert Event - Message: " + wEvent.getData()); }); webEngine.load("http://java2s.com"); final WebHistory history = webEngine.getHistory(); history.getEntries().addListener(new ListChangeListener<WebHistory.Entry>() { @Override public void onChanged(Change<? extends Entry> c) { c.next(); for (Entry e : c.getRemoved()) { System.out.println(e.getUrl()); } for (Entry e : c.getAddedSubList()) { System.out.println(e.getUrl()); } } }); history.go(0); scene.setRoot(scrollPane); stage.setScene(scene); stage.show(); }