Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8089835

[Canvas] NullPointerException when viewing large Canvas in ScrollPane

    Details

    • Type: Bug
    • Status: Open
    • Priority: P4
    • Resolution: Unresolved
    • Affects Version/s: 8u20
    • Fix Version/s: tbd
    • Component/s: javafx
    • Labels:
    • Environment:

      Win 7 Pro, JDK 8 b123 x64

      Description

      When I create a large Canvas and put it into a ScollPane I get a NullPointerException as soon as the program starts:

      java.lang.NullPointerException
      at com.sun.javafx.sg.prism.NGCanvas$RenderBuf.validate(NGCanvas.java:199)
      at com.sun.javafx.sg.prism.NGCanvas.initCanvas(NGCanvas.java:598)
      at com.sun.javafx.sg.prism.NGCanvas.renderContent(NGCanvas.java:575)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2043)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1951)
      at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:225)
      at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:575)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2043)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1951)
      at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:225)
      at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:575)
      at com.sun.javafx.sg.prism.NGNode.renderForClip(NGNode.java:2282)
      at com.sun.javafx.sg.prism.NGNode.renderRectClip(NGNode.java:2176)
      at com.sun.javafx.sg.prism.NGNode.renderClip(NGNode.java:2202)
      at com.sun.javafx.sg.prism.CacheFilter.impl_renderNodeToCache(CacheFilter.java:655)
      at com.sun.javafx.sg.prism.CacheFilter.render(CacheFilter.java:561)
      at com.sun.javafx.sg.prism.NGNode.renderCached(NGNode.java:2346)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2034)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1951)
      at com.sun.javafx.sg.prism.NGGroup.renderContent(NGGroup.java:225)
      at com.sun.javafx.sg.prism.NGRegion.renderContent(NGRegion.java:575)
      at com.sun.javafx.sg.prism.NGNode.doRender(NGNode.java:2043)
      at com.sun.javafx.sg.prism.NGNode.render(NGNode.java:1951)
      at com.sun.javafx.tk.quantum.ViewPainter.doPaint(ViewPainter.java:469)
      at com.sun.javafx.tk.quantum.ViewPainter.paintImpl(ViewPainter.java:324)
      at com.sun.javafx.tk.quantum.PresentingPainter.run(PresentingPainter.java:89)
      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:129)
      at java.lang.Thread.run(Thread.java:744)


      Sample Code:

      package application;

      import javafx.application.Application;
      import javafx.scene.Scene;
      import javafx.scene.canvas.Canvas;
      import javafx.scene.control.ScrollPane;
      import javafx.stage.Stage;

      public class NPELargeCanvas extends Application
      {
      @Override
      public void start(final Stage primaryStage)
      {
      final double x = 2500;
      final double y = 10000;
      final Canvas canvas = new Canvas(x,y);

      final ScrollPane pane = new ScrollPane();
      pane.setContent(canvas);

      primaryStage.setScene(new Scene(pane));
      primaryStage.show();
      }

      public static void main(final String[] args)
      {
      launch(args);
      }

      }


      Steps to Reproduce:
      1) Just launch the program

        Attachments

          Activity

            People

            • Assignee:
              Unassigned
              Reporter:
              cmuthingjfx Clemens Muthing (Inactive)
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Imported: