JDK-8119847 : ImageCursor class needs a builder so that it can be encoded in FXML
  • Type: Bug
  • Component: javafx
  • Sub-Component: fxml
  • Affected Version: 8
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • Submitted: 2013-09-05
  • Updated: 2015-06-17
  • Resolved: 2013-11-22
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
8Fixed
Related Reports
Blocks :  
Description
Currently it's not possible to encode an ImageCursor in FXML (see the test below).
After discussing with Milan, the conclusion is that a new builder must be defined for ImageCursor.

I wrote the following FXML:

	<?xml version="1.0" encoding="UTF-8"?>

	<?import javafx.scene.*?>

	<ImageCursor image="@Jupiter.gif" hotspotX="5.0" hotspotY="10.0" xmlns:fx="http://javafx.com/fxml/1"/>

and tried to load it with FXMLLoader.


java.io.IOException: com.sun.javafx.fxml.PropertyNotFoundException: Property "image" does not exist or is read-only.
	at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:56)
	at com.oracle.javafx.scenebuilder.kit.fxom.FXOMDocument.<init>(FXOMDocument.java:41)
	at com.oracle.javafx.scenebuilder.kit.editor.EditorController.updateFxomDocument(EditorController.java:884)
	at com.oracle.javafx.scenebuilder.kit.editor.EditorController.setFxmlTextLocationAndResources(EditorController.java:321)
	at com.oracle.javafx.scenebuilder.probe.MainWindowController.openFxml(MainWindowController.java:559)
	at com.oracle.javafx.scenebuilder.probe.MainWindowController.openFxml(MainWindowController.java:546)
	at com.oracle.javafx.scenebuilder.probe.MainWindowController.onOpenFileMenuAction(MainWindowController.java:538)
	at com.oracle.javafx.scenebuilder.probe.MainWindowController.onOpenCloseFileMenuAction(MainWindowController.java:290)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:491)
	at sun.reflect.misc.Trampoline.invoke(MethodUtil.java:71)
	at sun.reflect.GeneratedMethodAccessor1.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:491)
	at sun.reflect.misc.MethodUtil.invoke(MethodUtil.java:275)
	at javafx.fxml.FXMLLoader$ControllerMethodEventHandler.handle(FXMLLoader.java:1500)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
	at javafx.event.Event.fireEvent(Event.java:203)
	at javafx.scene.Node.fireEvent(Node.java:8034)
	at javafx.scene.control.Button.fire(Button.java:184)
	at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
	at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
	at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
	at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
	at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
	at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
	at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
	at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
	at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
	at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
	at javafx.event.Event.fireEvent(Event.java:203)
	at javafx.scene.Scene$MouseHandler.process(Scene.java:3581)
	at javafx.scene.Scene$MouseHandler.process(Scene.java:3375)
	at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3326)
	at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1612)
	at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2389)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:322)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:247)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:364)
	at com.sun.glass.ui.View.handleMouseEvent(View.java:517)
	at com.sun.glass.ui.View.notifyMouse(View.java:882)
Caused by: com.sun.javafx.fxml.PropertyNotFoundException: Property "image" does not exist or is read-only.
	at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:250)
	at com.sun.javafx.fxml.BeanAdapter.put(BeanAdapter.java:58)
	at javafx.fxml.FXMLLoader$Element.applyProperty(FXMLLoader.java:503)
	at javafx.fxml.FXMLLoader$Element.processValue(FXMLLoader.java:360)
	at javafx.fxml.FXMLLoader$Element.processPropertyAttribute(FXMLLoader.java:322)
	at javafx.fxml.FXMLLoader$Element.processInstancePropertyAttributes(FXMLLoader.java:234)
	at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:635)
	at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2605)
	at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2304)
	at com.oracle.javafx.scenebuilder.kit.fxom.FXOMLoader.load(FXOMLoader.java:53)
	... 60 more
Comments
Yes, except that the ImageCursor fxml looks like this: <ImageCursor hotspotX="5.0" hotspotY="10.0" xmlns:fx="http://javafx.com/fxml/1"> <image> <Image url="@duke.jpg"/> </image> </ImageCursor> So closing as fixed.
22-11-2013

Now that the other two issues are fixed, can this issue be closed?
21-11-2013

We've left this one open to not to forget to check ImageCursor loading once RT-32859 and RT-32862 are fixed.
30-10-2013

Should this be closed as a duplicate?
30-10-2013

Probably will be fixed by RT-32859 and RT-32862.
11-09-2013

This should either be solved by adding new internal builder for ImageCursor to FXML (not a new builder to public API which is frozen now) or by annotating the constructor of ImageCursor and add support for loading classes with annotated constructors to FXML.
05-09-2013