JDK-8116851 : Some controls become black after screen lock or windowing environment change
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 8
  • Priority: P2
  • Status: Resolved
  • Resolution: Duplicate
  • Submitted: 2013-05-13
  • Updated: 2015-06-17
  • Resolved: 2013-10-15
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 8
8Resolved
Related Reports
Blocks :  
Blocks :  
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Relates :  
Relates :  
Description
This is a similar issue to RT-25178 which was previously fixed, but is now a problem again. I don't know how long this has been an issue, since the problem was masked by the fact that D3D9Ex was enabled by default for the last few months and was only recently turned off (see RT-30352).

If you run Ensemble or other app that uses controls, and leave region caching enabled (which it is by default), you will start to see artifacts in the rendering of controls if you go into screen lock / sleep and then come out of it.
Comments
Yes, there is a performance hit depending on how much your application benefits from the dirty region optimization. Note also that this flag is intended only for developer debugging and is not supported for deploying an application (although there are no known issues other than performance).
22-04-2014

As an additional note: -Dprism.dirtyopts=false makes the problem disappear.
22-04-2014

I can still reproduce with JavaFX 8 GA (8.0.0-b132): Put JavaFX App to background (i.e. have focus on another Window), then lock the screen, then return to screen, then bring JavaFX to front again (e.g. by clicking on the taskbar icon or use Alt+Tab): Application is black (or parts of it). Note that the application does not need to be iconified in the taskbar as in RT-31272. Just in the background. Unfortunately the workaround -Dprism.disableRegionCaching=true does not solve the problem for me. Any other ideas?
22-04-2014

This workaround removes the black for my application as well. Do we have to worry about performance problems with this enabled?
22-04-2014

I've found another way to make the entire Stage go black temporarily. I just use a large Canvas to do some image processing. It isn't attached to a Scene. I just need to do some image compositing with different blending rules and then take a snapshot. My app that does this frequently has the entire JavaFX window (where I'm not even showing the Canvas) go black. IIt then comes back and redraws if I resize of hover or do something that forces it to paint. The issue appears to be related to graphics resources.
31-03-2014

This issue is still reproducible in the General Availability release of Java 8. To reproduce run the sample Swing/JavaFx code from http://docs.oracle.com/javafx/2/swing/swing-fx-interoperability.htm with an additional button added to the Scene. Lock, then unlock the screen and you'll notice the text that was part of the scene has gone blank. The scene doesn't seem to go blank if the button is removed from the hierarchy. The code to reproduce is below: import javax.swing.JFrame; import javax.swing.SwingUtilities; import javafx.application.Platform; import javafx.embed.swing.JFXPanel; import javafx.scene.Group; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.paint.Color; import javafx.scene.text.Font; import javafx.scene.text.Text; public class SwingTest { private static void initAndShowGUI() { // This method is invoked on the EDT thread JFrame frame = new JFrame("Swing and JavaFX"); final JFXPanel fxPanel = new JFXPanel(); frame.add(fxPanel); frame.setSize(300, 200); frame.setVisible(true); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); Platform.runLater(new Runnable() { @Override public void run() { initFX(fxPanel); } }); } private static void initFX(JFXPanel fxPanel) { // This method is invoked on the JavaFX thread Scene scene = createScene(); fxPanel.setScene(scene); } private static Scene createScene() { Group root = new Group(); Scene scene = new Scene(root, Color.ALICEBLUE); Text text = new Text(); text.setX(40); text.setY(100); text.setFont(new Font(25)); text.setText("Welcome JavaFX!"); root.getChildren().add(text); root.getChildren().addAll(new Button("Test Button")); return (scene); } public static void main(String[] args) { SwingUtilities.invokeLater(new Runnable() { @Override public void run() { initAndShowGUI(); } }); } }
30-03-2014

When it happens I get ton of messages printed to the console "Exception in thread "JavaFX Application Thread" java.lang.NullPointerException" With no stack trace. This is easily triggered by connecting to the machine with Remote Desktop.
26-11-2013

This issue remains in JavaFX 8.0b117
26-11-2013

RT-33017
15-10-2013

OK, I think I get what you are saying. However, the problem isn't a failure to refresh, it's a failure somewhere to react to a lost surface. We know what we need to do to recreate the textures...we just aren't doing it right.
11-09-2013

Hi Kevin, I understand the problem but what I'm saying is that this reaction from the Prism implementation of Region caching could be triggered by this event(focused), or in the same way. Because this event is still working. Is it possible what I'm saying?
11-09-2013

Diego: I don't understand how your above comment relates to this bug. The problem described in this bug is that the Prism implementation of Region caching doesn't react to a D3D lost surface, and fails to recreate the textures. It has nothing to do with focus.
11-09-2013

I saw that the property focused, from stage, works. Why don't we use it to trigger the refresh? [...] private void init(Stage primaryStage) { BorderPane root = new BorderPane(); final Scene scene = new Scene(root, 600.0, 400.0); primaryStage.setScene(scene); primaryStage.focusedProperty().addListener(new ChangeListener<Boolean>() { @Override public void changed(ObservableValue<? extends Boolean> observableValue, Boolean aBoolean, Boolean aBoolean2) { System.out.println("Focused proprety."); } }); [...] Each time the screen is locked and then unlocked or minimized, "Focused proprety." is printed out. I didn't try anything else but I think that it could be used to triggered the refresh. I don't know how would be the best way to do it. And this solution could work for javafx 2.x. How would be the best way to trigger the refresh?
11-09-2013

Any chance to have this fixed soon ? Putting the workaround in place is not a good option, since it degrades the perf.
03-07-2013

I also got this yesterday when changing my screen resolution for a demo with a video projector. This didn't really make a good impression about JavaFx on the audience...
03-07-2013

Note that the issue also appears when a window popup from anothe application appears. For instance, I got this once when Firefox raised a popup error window.
31-05-2013

Note that since there is a workaround, and we are still in early access for FX 8, this is a Major bug (else it would be Critical).
31-05-2013

The workaround is to disable region caching, which will cause performance to drop so should only be used for debugging. java -Dprism.disableRegionCaching=true
13-05-2013