JDK-8088179 : [Quantum] White flashing when opening a stage with dark background
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 8,9
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2014-06-02
  • Updated: 2022-05-07
  • Resolved: 2016-11-12
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 9
9 b145Fixed
Related Reports
Relates :  
Relates :  
Relates :  
Relates :  
Relates :  
Sub Tasks
JDK-8175966 :  
Description
The following code opens a stage with a dark background color. On my system (see environment) this results in a white flashing when the stage is shown, i.e. there appears to be at least one paint operation before the background color has been applied. This is a show-stopper for delivering our commercial product quality-wise.

{code}
import javafx.application.Application;
import javafx.geometry.Insets;
import javafx.scene.Scene;
import javafx.scene.layout.Background;
import javafx.scene.layout.BackgroundFill;
import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.StackPane;
import javafx.scene.paint.Color;
import javafx.stage.Stage;

public class JFXFlashTest extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        final StackPane pane = new StackPane();
        pane.setBackground(new Background(new BackgroundFill(Color.rgb(54, 54, 54), CornerRadii.EMPTY, Insets.EMPTY)));
        final Scene scene = new Scene(pane, 1024, 768);
        primaryStage.setScene(scene);
        primaryStage.show();
    }

    public static void main(String[] args) {
        launch(args);
    }
}
{code}
Comments
Changeset: bfe35c702696 Author: ckyang Date: 2016-11-12 09:52 -0800 URL: http://hg.openjdk.java.net/openjfx/9-dev/rt/rev/bfe35c702696
12-11-2016

+1
11-11-2016

There is actually 2 parts to the reported bug. First JavaFX needs to set background color when creating a WindowStage with non null Fill. Second the test program needs to create a Scene with meaningful Fill if it doesn't want the flash. The proposed fix is to set WindowStage background to a meaningful color if Fill is a Color, LinearGradient or RadialGradient. A null or ImagePattern Fill will continue to have its current behavior. http://cr.openjdk.java.net/~ckyang/JDK-8088179/webrev.00/
10-11-2016

Attached user test program with a fix to the program to set a meaningful Fill.
10-11-2016

I think I noticed the White flashing at startup if I focused on the lower right corner of the window when it first appeared. Just like Steve commented, it happened so fast that I didn't even notice it if I just share at the center of the screen.
04-11-2016

I'm unable to reproduce this white flashing bug on my Mac running either JDK 8 or my local build JDK 9: Prism pipeline init order: es2 sw Using platform text rasterizer Using native-based Pisces rasterizer Using dirty region optimizations Not using texture mask for primitives Not forcing power of 2 sizes for textures Using hardware CLAMP_TO_ZERO mode Opting in for HiDPI pixel scaling Prism pipeline name = com.sun.prism.es2.ES2Pipeline Loading ES2 native library ... prism_es2 succeeded. GLFactory using com.sun.prism.es2.MacGLFactory (X) Got class = class com.sun.prism.es2.ES2Pipeline Initialized prism pipeline: com.sun.prism.es2.ES2Pipeline Maximum supported texture size: 16384 Maximum texture size clamped to 4096 Non power of two texture support = true Graphics Vendor: ATI Technologies Inc. Renderer: AMD Radeon R9 M370X OpenGL Engine Version: 2.1 ATI-1.42.15 vsync: true vpipe: true QuantumRenderer: shutdown
04-11-2016

Approved by component triage team to defer
15-08-2016

Chien, does it affect 8 GA as well? (not just 8u5 as i can see in Affects version)?
11-08-2016

I took a look at this today, and I can reproduce it on my Mac using Tom's test program. We really should fix this for JDK 9.
09-12-2015

@Steve: "It might be possible to make the UI wait until at least one pulse has happened before showing the window. A change like this is likely much to risky for 8u20 but could be looked into for 8u40" Could you give pointers into the code where that change would have to be made? This issue being of priority minor for 9 is a serious problem for us because our product has a dark UI and switching from Swing to JFX will make it look very unprofessional (feeding the old anti-java prejudice). I would like to evaluate if we could fix this in our own JRE build if Oracle doesn't address this in the coming weeks or if we have to stop our JFX porting activities for the time being.
23-05-2015

Setting the fill directly on the Stage constructor doesn't help either.. same flash with this: {code} @Override public void start(Stage primaryStage) throws Exception { StackPane pane = new StackPane(); Scene scene = new Scene(pane, 800, 600, Color.RED); primaryStage.setScene(scene); primaryStage.show(); } {code}
10-02-2015

I can easily reproduce this problem with the follwing app. Minor addition: The flashing does NOT happen if you create the stage with style TRANSPARENT but with any other style! The new dialogs are also affected by this bug and so they feel very slugish with dark UIs! package application; import javafx.application.Application; import javafx.application.Platform; import javafx.geometry.Insets; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.layout.Background; import javafx.scene.layout.BackgroundFill; import javafx.scene.layout.BorderPane; import javafx.scene.layout.CornerRadii; import javafx.scene.paint.Color; import javafx.stage.Stage; public class Main extends Application { Stage utility; @Override public void start(Stage primaryStage) { try { BorderPane root = new BorderPane(); root.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY))); Button b = new Button("Open"); b.setOnAction((e) -> open(primaryStage)); root.setCenter(b); Scene scene = new Scene(root,400,400); scene.setFill(Color.BLACK); primaryStage.setScene(scene); primaryStage.show(); } catch(Exception e) { e.printStackTrace(); } } private void open(Stage primaryStage) { if( utility == null ) { utility = new Stage(); BorderPane p = new BorderPane(); p.setBackground(new Background(new BackgroundFill(Color.BLACK, CornerRadii.EMPTY, Insets.EMPTY))); Scene value = new Scene(p,300,200); utility.setScene(value); utility.requestFocus(); utility.focusedProperty().addListener(o -> { if( ! utility.isFocused() ) { Platform.runLater(() -> { utility.close(); }); } }); } Button center = new Button("Hello Util " + System.currentTimeMillis()); center.getStyleClass().addAll("test_ref"); ((BorderPane)utility.getScene().getRoot()).setCenter(center); utility.show(); } public static void main(String[] args) { launch(args); } }
15-01-2015

FYI, I experience the same issue on Ubuntu 14.04. $ java -version java version "1.8.0_25" Java(TM) SE Runtime Environment (build 1.8.0_25-b17) Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
09-11-2014

Nope, I believe you but it is just very fast for me. It might be possible to make the UI wait until at least one pulse has happened before showing the window. A change like this is likely much to risky for 8u20 but could be looked into for 8u40. It will take longer for the window to show, but when it comes up, there will be some content.
03-06-2014

The clip was taken on a cinema display but the effect is the same on the built-in display. I can check on a few other macs if that helps.
03-06-2014

It's just very fast on my system.
03-06-2014

I believe you that is is happening. Your monitor / screen resolution is much higher than mine. I will try that.
03-06-2014

No, I have not. What you see in the background of the clip is the Idea IDE window with Darkula Look & Feel maximized to cover the entire screen (not full-screen mode). The OS settings regarding color are untouched.
03-06-2014

Ok, you have changed your system color to make your desktop dark. What settings have you changed?
03-06-2014

I just rechecked with 8u20 I just rechecked with 1.8.0_20-ea-b16 and it is the same. I have also checked with the built-in retina display and an external monitor. All the same. The flash is visible. Here is a screen recording of the effect: https://www.dropbox.com/s/gq4z3dr4boohsoj/RT-37372-screen-recording.mov Just for completeness some more detailed system info: Hardware: Hardware Overview: Model Name: MacBook Pro Model Identifier: MacBookPro10,1 Processor Name: Intel Core i7 Processor Speed: 2,3 GHz Number of Processors: 1 Total Number of Cores: 4 L2 Cache (per Core): 256 KB L3 Cache: 6 MB Memory: 16 GB Boot ROM Version: MBP101.00EE.B02 SMC Version (system): 2.3f36 Software: System Software Overview: System Version: OS X 10.9.3 (13D65) Kernel Version: Darwin 13.2.0 Time since boot: 3 days 20:05
03-06-2014

I have the same hardware and I don't see the issue. Do I need to put a delay somewhere? We have the ability to force the UI thread to wait for the Render thread to complete so it would be possible to draw right away in "paint". Note that on Mac, since the code was changed to use CALayers, paint events no longer come.
02-06-2014

This issue seems to be related: RT-16804
02-06-2014