Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JavaFX 8: Blank scene after monitor out of standby

I'm having a weird issue with JavaFX (jdk8, build 117): once the monitor resumes from standby the JavaFX stage/scene is blank.

I've tried minimizing/resizing the window but the contents are no longer displayed. I'm using a simple scene with a StackPane.

    root = new StackPane();
    root.setBackground(null);
    scene = new Scene(root, Color.BLACK);
    stage.setScene(scene);

    ProgressIndicator piLoader = new ProgressIndicator();
    piLoader.setMaxSize(32d, 32d);
    root.getChildren().add(piLoader);

    stage.show();

I've tried searching for a known bug or a previous report but could not find any.

like image 322
alibotean Avatar asked Dec 15 '13 10:12

alibotean


1 Answers

JDK8 is still very much in flux & marked as an early access release, so issues like this should be expected. I've just tested it on JDK8 built b121 (Win8 64bit & Ubuntu 13.10 64bit) and it appears to be fine.

Update your JDK version to the latest & see if that resolves the issue for you.

UPDATE: Here's a full stock-standard example that works without problem for me, monitor goes into sleep mode & comes back without any display issues. 'Sleep mode' is the only option Windows 8 is giving me, so not 'Standby' as you're referring to. Which OS are you using?

package helloworld;

import javafx.application.Application;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class HelloWorld extends Application {

    @Override
    public void start(Stage primaryStage) {
        Button btn = new Button();
        btn.setText("Say 'Hello World'");
        btn.setOnAction(new EventHandler<ActionEvent>() {

            @Override
            public void handle(ActionEvent event) {
                System.out.println("Hello World!");
            }
        });

        StackPane root = new StackPane();
        root.setBackground(null);
        root.getChildren().add(btn);

        ProgressIndicator piLoader = new ProgressIndicator();
        piLoader.setMaxSize(32d, 32d);
        root.getChildren().add(piLoader);

        Scene scene = new Scene(root, 300, 250, Color.BLACK);

        primaryStage.setTitle("Hello World!");
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        launch(args);
    }

}
like image 177
simsam7 Avatar answered Oct 15 '22 23:10

simsam7