JDK-8174077 : Cannot use large Canvas as ScrollPane content
  • Type: Bug
  • Component: javafx
  • Sub-Component: graphics
  • Affected Version: 8u121
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_10
  • CPU: x86
  • Submitted: 2017-02-06
  • Updated: 2020-09-02
  • Resolved: 2020-09-02
Related Reports
Duplicate :  
Relates :  
Relates :  
Description
FULL PRODUCT VERSION :
java version "1.8.0_121"
Java(TM) SE Runtime Environment (build 1.8.0_121-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.121-b13, mixed mode)

ADDITIONAL OS VERSION INFORMATION :
WIndows Version 10.0.14393

A DESCRIPTION OF THE PROBLEM :
App has a ScrollPane that rougly occupied 1/4 of Scene.  The latter is 1670w x 1000h.  The App has several controls over the Scene (in child containers).

Attempts to set the  ScrollPane with a large Canvas causes NPEs and results in a blank Scene.  Reduce the Canvas size, and all is well.

The problem is that the Canvas is being used to hold representations of music tracks, and once the track has enough bars, the Canvas needs widening to accomodate.  But initial investigation, setting the Canvas bigger in th first place, causes this bug to show up, making the app non-viable for shipping.

In short, this is DISASTROUS.  

STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
Depending on canvas width, this causes application to fail to render anything.  Just get a blank window.



EXPECTED VERSUS ACTUAL BEHAVIOR :
EXPECTED -
A canvas that can be scrolled
ACTUAL -
Blank scene

ERROR MESSAGES/STACK TRACES THAT OCCUR :
NPE
at com.sun.javafx.sg.prism.NGCanvas$RenderBuf.validate(NGCanvas.java:213)
	at com.sun.javafx.sg.prism.NGCanvas.initCanvas(NGCanvas.java:640)
	at com.sun.javafx.sg.prism.NGCanvas.renderForcedContent(NGCanvas.java:624)
	at com.sun.javafx.sg.prism.NGGroup.renderForcedContent(NGGroup.java:198)
	at com.sun.javafx.sg.prism.NGGroup.renderForcedContent(NGGroup.java:198)
	at com.sun.javafx.sg.prism.NGGroup.renderForcedContent(NGGroup.java:198)
	at com.sun.javafx.sg.prism.NGGroup.renderForcedContent(NGGroup.java:198)
	at com.sun.javafx.sg.prism.NGGroup.renderForcedContent(NGGroup.java:198)
	at com.sun.javafx.sg.prism.NGGroup.renderForcedContent(NGGroup.java:198)
	at com.sun.javafx.sg.prism.NGGroup.renderForcedContent(NGGroup.java:198)
	at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:332)
	at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:91)
	at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
	at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
	at com.sun.javafx.tk.RenderJob.run(RenderJob.java:58)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at com.sun.javafx.tk.quantum.QuantumRenderer$PipelineRunnable.run(QuantumRenderer.java:125)
	at java.lang.Thread.run(Thread.java:745)


REPRODUCIBILITY :
This bug can be reproduced always.

---------- BEGIN SOURCE ----------
ScrollPane initial size set in SceneBuilder: width 665, height 200:   The ScrollPane is a child of AnchorPane, 1670w x 1000h

        private void configureCanvas(boolean remember, ScrollPane pane,
			Canvas c) {
		c.setHeight(pane.getHeight() * 4);
		c.setWidth(pane.getWidth() * 8);
		pane.setContent(c);
	}

Change 8 to 20, and the app is ruined.
---------- END SOURCE ----------

CUSTOMER SUBMITTED WORKAROUND :
Restrict size.  MAkes app useless at that point,  App cannot be released.


Comments
This is a duplicate of JDK-8090178
02-09-2020

This bug is likely a related or duplicate of JDK-8088198 and JDK-8088135
10-02-2017

Actually, looking at the code snippet I am almost certain that this is a (known and long-standing) graphics issue that arises when dealing with surfaces that exceed the texture bounds of the system.
07-02-2017

Given the stack trace, this might be a graphics bug rather than a controls bug in ScrollPane itself. [~jgiles] Feel free to reassign if you discover that it is a graphics bug.
07-02-2017