-
Bug
-
Resolution: Not an Issue
-
P3
-
None
-
8u40
-
Windows JDK8u40
NullPointerExeption when progress changes fast.
The same code with a ProgressBar works.
{code}
package javafxapplication2;
import javafx.application.Application;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Scene;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class JavaFXApplication2 extends Application {
@Override
public void start(Stage primaryStage) {
ProgressIndicator pIndicator = new ProgressIndicator(0.0);
//ProgressBar pIndicator = new ProgressBar(0.0);
final SimpleDoubleProperty processProperty = new SimpleDoubleProperty(0.0);
processProperty.addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
pIndicator.setProgress(newValue.doubleValue());
}
});
StackPane root = new StackPane();
root.getChildren().add(pIndicator);
Scene scene = new Scene(root, 300, 250);
primaryStage.setScene(scene);
primaryStage.show();
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
double p = processProperty.get();
p += 0.01;
if (p > 1.0) {
p = 0.0;
}
Thread.sleep(5);
processProperty.set(p);
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
}
}).start();
}
public static void main(String[] args) {
launch(args);
}
}
{code}
The same code with a ProgressBar works.
{code}
package javafxapplication2;
import javafx.application.Application;
import javafx.beans.property.SimpleDoubleProperty;
import javafx.beans.value.ChangeListener;
import javafx.beans.value.ObservableValue;
import javafx.scene.Scene;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
public class JavaFXApplication2 extends Application {
@Override
public void start(Stage primaryStage) {
ProgressIndicator pIndicator = new ProgressIndicator(0.0);
//ProgressBar pIndicator = new ProgressBar(0.0);
final SimpleDoubleProperty processProperty = new SimpleDoubleProperty(0.0);
processProperty.addListener(new ChangeListener<Number>() {
@Override
public void changed(ObservableValue<? extends Number> observable, Number oldValue, Number newValue) {
pIndicator.setProgress(newValue.doubleValue());
}
});
StackPane root = new StackPane();
root.getChildren().add(pIndicator);
Scene scene = new Scene(root, 300, 250);
primaryStage.setScene(scene);
primaryStage.show();
new Thread(new Runnable() {
@Override
public void run() {
while (true) {
try {
double p = processProperty.get();
p += 0.01;
if (p > 1.0) {
p = 0.0;
}
Thread.sleep(5);
processProperty.set(p);
} catch (Exception e) {
e.printStackTrace(System.out);
}
}
}
}).start();
}
public static void main(String[] args) {
launch(args);
}
}
{code}