JavaFX : voeg een ProgressIndicator of ProgessBar toe.
JavaFX : add a ProgressIndicator or a ProgressBar.
JavaFX: aƱadir un ProgressIndicator o ProgessBar.
prog:
eclipse-standard-kepler-SR1-win32
Java :: jre7 (or/of 8) (external jar for jre7 :: C:Program Files/Java/jre7/lib/jfxrt.jar)
Voorbeeld | Example | Ejemplo
ProgressIndicator pi = new ProgressIndicator();
ProgressBar pb = new ProgressBar();
...
...
...
public WebBrowser() {
rootvbox = new VBox();
webView = new WebView();
pi.setMinSize(40, 40);
pb.setMaxWidth(webView.getMaxWidth());
final WebEngine webEngine = webView.getEngine();
webEngine.load(Start_URL);
webEngine.getLoadWorker().progressProperty().addListener(new ChangeListener<Object>(){
@Override
public void changed(ObservableValue<?> arg0, Object arg1, Object arg2) {
pi.setProgress((Double) arg0.getValue());
pb.setProgress((Double) arg0.getValue());
//OR:
//pi.setProgress(webEngine.getLoadWorker().getProgress());
//pb.setProgress(webEngine.getLoadWorker().getProgress());
System.out.println("Progress"+webEngine.getLoadWorker().getProgress()*100);
System.out.println("Value arg0 (=arg2): "+(Double)arg0.getValue()*100);
System.out.println("End value prev check :: arg1: "+(Double)arg1*100);
System.out.println("End value ckeck :: arg2 :"+(Double)arg2*100);
}
});
final TextField locationField = new TextField(Start_URL);
...
...
...
}
|