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

Setting ImageView's Image from a style sheet failing

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • fx2.1
    • fx2.1
    • javafx
    • Mac OS X 10.7, JavaFX version: 2.1.0-beta-b07

      After upgrading to 2.1 preview build 7, I started seeing exceptions when starting apps where images were set in the stylesheet.


      #volumeHigh {
        -fx-image: url("resources/volHigh.png");
      }

      The exceptions happen during the app's call to Stage#show in the start method. The stack trace is:

      WARNING: com.sun.javafx.css.StyleHelper transitionToState Failed to set css [StyleableProperty {property: -fx-image, converter: javafx.scene.image.ImageView$StyleableProperties$1@43684706, initalValue: null, inherits: false, subProperties: []}]

      java.lang.ClassCastException: java.lang.String cannot be cast to javafx.scene.image.Image
      at javafx.scene.image.ImageView$1.invalidated(ImageView.java:200)
      at javafx.beans.property.ObjectPropertyBase.markInvalid(ObjectPropertyBase.java:88)
      at javafx.beans.property.ObjectPropertyBase.set(ObjectPropertyBase.java:122)
      at com.sun.javafx.css.StyleableObjectProperty.set(StyleableObjectProperty.java:52)
      at com.sun.javafx.css.StyleableObjectProperty.applyStyle(StyleableObjectProperty.java:40)
      at com.sun.javafx.css.StyleableProperty.set(StyleableProperty.java:40)
      at com.sun.javafx.css.StyleHelper.transitionToState(StyleHelper.java:771)
      at javafx.scene.Node.impl_processCSS(Node.java:6458)
      at javafx.scene.Parent.impl_processCSS(Parent.java:982)
      at javafx.scene.Parent.impl_processCSS(Parent.java:982)
      at javafx.scene.Parent.impl_processCSS(Parent.java:982)
      at javafx.scene.Node.processCSS(Node.java:6426)
      at javafx.scene.Scene.doCSSPass(Scene.java:404)
      at javafx.scene.Scene.preferredSize(Scene.java:1208)
      at javafx.scene.Scene.impl_preferredSize(Scene.java:1258)
      at javafx.stage.Window.adjustSize(Window.java:139)
      at javafx.stage.Window.access$800(Window.java:50)
      at javafx.stage.Window$13.invalidated(Window.java:692)
      at javafx.beans.property.BooleanPropertyBase.markInvalid(BooleanPropertyBase.java:88)
      at javafx.beans.property.BooleanPropertyBase.set(BooleanPropertyBase.java:122)
      at javafx.stage.Window.setShowing(Window.java:744)
      at javafx.stage.Window.show(Window.java:759)
      at javafx.stage.Stage.show(Stage.java:129)
      at projavafx.audioplayer4.AudioPlayer4.start(AudioPlayer4.java:89)
      at com.sun.javafx.application.LauncherImpl$5.run(LauncherImpl.java:299)
      at com.sun.javafx.application.PlatformImpl$4.run(PlatformImpl.java:153)
      at com.sun.javafx.application.PlatformImpl$3.run(PlatformImpl.java:120)

      Did something change in how images are specified?

            dgrieve David Grieve
            diversonjfx Dean Iverson (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: