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

[Dialogs] HelloDialogs toy throws NPE with custom graphic

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • 8u40
    • 8u40
    • javafx
    • None

    Description

      Start HelloDialogs, tick "Use custom graphic".
      Any dialog except custom dialogs will throw NPE:
      Exception in thread "JavaFX Application Thread" java.lang.NullPointerException
      at hello.HelloDialogs.configureSampleDialog(HelloDialogs.java:427)
      at hello.HelloDialogs.lambda$start$7(HelloDialogs.java:224)
      at hello.HelloDialogs$$Lambda$81/120593124.handle(Unknown Source)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
      ...

      The reason is that it can't find "tick.png" in the classpath here:
      dlg.getDialogPane().setGraphic(new ImageView(new Image(getClass().getResource("tick.png").toExternalForm())));
      The fix is as simple as
      dlg.getDialogPane().setGraphic(new ImageView(new Image(getClass().getResource("dialog/tick.png").toExternalForm())));

      Attachments

        Activity

          People

            morris Morris Meyer (Inactive)
            vadim Vadim Pakhnushev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:
              Imported: