-
Bug
-
Resolution: Fixed
-
P3
-
8
-
Mac OS X 10.7.5; JDK 1.8.0 ea b101.
If an attempt is made to create a Control off the JavaFX Application Thread before any other Controls are created, an uncaught exception is generated in the static initializer of Control. This prevents creation of any controls. See the OTN discussion at https://forums.oracle.com/thread/2568357
Thanks to jsmith for the analysis.
To recreate the problem, run the following sample code, also courtesy of jsmtih.
import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ControlBreak extends Application {
@Override
public void start(Stage stage) throws Exception {
final StackPane layout = new StackPane();
stage.setScene(new Scene(layout));
stage.show();
ExecutorService exec = Executors.newSingleThreadScheduledExecutor();
exec.submit(new Task<Label>() {
{
setOnSucceeded(event -> layout.getChildren().add(getValue()));
setOnFailed(event -> getException().printStackTrace());
}
@Override
protected Label call() throws Exception {
return new Label("xyzzy");
}
});
exec.shutdown();
}
public static void main(String[] args) { launch(); }
}
Thanks to jsmith for the analysis.
To recreate the problem, run the following sample code, also courtesy of jsmtih.
import javafx.application.Application;
import javafx.concurrent.Task;
import javafx.scene.Scene;
import javafx.scene.control.Label;
import javafx.scene.layout.StackPane;
import javafx.stage.Stage;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
public class ControlBreak extends Application {
@Override
public void start(Stage stage) throws Exception {
final StackPane layout = new StackPane();
stage.setScene(new Scene(layout));
stage.show();
ExecutorService exec = Executors.newSingleThreadScheduledExecutor();
exec.submit(new Task<Label>() {
{
setOnSucceeded(event -> layout.getChildren().add(getValue()));
setOnFailed(event -> getException().printStackTrace());
}
@Override
protected Label call() throws Exception {
return new Label("xyzzy");
}
});
exec.shutdown();
}
public static void main(String[] args) { launch(); }
}