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

Cannot save/load a MenuItem with an accelerator

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P2 P2
    • 7u40
    • 7u40
    • javafx
    • None

      Drop a MenuBar .
      From the Hierarchy, select a MenuItem.
      From the inspector, click on the accelerator editor, and set a Ctrl-C (for instance) accelerator.

      Save the document.
      If you have a look at it, you can see that only the mainKey is saved, the Ctrl modifier is missing.

      Exit the tool, and load the document.
      The following exception is raised :

      WARNING: Failed to build instance of class javafx.scene.input.KeyCodeCombination using class javafx.scene.input.KeyCodeCombinationBuilder
      java.lang.reflect.InvocationTargetException
      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:601)
      at javafx.fxml.JavaFXBuilder$ObjectBuilder.build(JavaFXBuilderFactory.java:212)
      at javafx.fxml.FXMLLoader$ValueElement.processEndElement(FXMLLoader.java:584)
      at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2431)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2136)
      at com.oracle.javafx.authoring.persist.FXMLDocument$1.call(FXMLDocument.java:164)
      at com.oracle.javafx.authoring.util.Utils.withFXMLDefaultClassLoader(Utils.java:2162)
      at com.oracle.javafx.authoring.persist.FXMLDocument.load(FXMLDocument.java:161)
      at com.oracle.javafx.authoring.persist.LoadFxml$2.call(LoadFxml.java:67)
      at com.oracle.javafx.authoring.persist.LoadFxml.loadElement(LoadFxml.java:150)
      at com.oracle.javafx.authoring.persist.LoadFxml.loadScreenData(LoadFxml.java:199)
      at com.oracle.javafx.authoring.Project.forFxml(Project.java:798)
      at com.oracle.javafx.authoring.Project.forFxml(Project.java:773)
      at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:164)
      at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:153)
      at com.oracle.javafx.authoring.ApplicationMenu$94.handle(ApplicationMenu.java:2739)
      at com.oracle.javafx.authoring.ApplicationMenu$94.handle(ApplicationMenu.java:2736)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:28)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.control.MenuItem.fire(MenuItem.java:456)
      at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer.doSelect(ContextMenuContent.java:1188)
      at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer$6.handle(ContextMenuContent.java:1139)
      at com.sun.javafx.scene.control.skin.ContextMenuContent$MenuItemContainer$6.handle(ContextMenuContent.java:1137)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:170)
      at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:38)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:37)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:35)
      at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:92)
      at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:53)
      at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:33)
      at javafx.event.Event.fireEvent(Event.java:171)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3324)
      at javafx.scene.Scene$MouseHandler.process(Scene.java:3164)
      at javafx.scene.Scene$MouseHandler.access$1900(Scene.java:3119)
      at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1559)
      at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2261)
      at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:228)
      at com.sun.glass.ui.View.handleMouseEvent(View.java:528)
      at com.sun.glass.ui.View.notifyMouse(View.java:922)
      at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
      at com.sun.glass.ui.win.WinApplication.access$100(WinApplication.java:29)
      at com.sun.glass.ui.win.WinApplication$2$1.run(WinApplication.java:67)
      at java.lang.Thread.run(Thread.java:722)
      Caused by: java.lang.NullPointerException: Modifier value must not be null!
      at javafx.scene.input.KeyCombination.<init>(KeyCombination.java:176)
      at javafx.scene.input.KeyCodeCombination.<init>(KeyCodeCombination.java:65)
      at javafx.scene.input.KeyCodeCombinationBuilder.build(KeyCodeCombinationBuilder.java:76)
      ... 57 more

      C:\wksfx\fxml\src\fxml\test2.fxml:18: error:
      java.lang.UnsupportedOperationException: Failed to create element KeyCodeCombination
      java.lang.UnsupportedOperationException: Failed to create element KeyCodeCombination
      at com.oracle.javafx.authoring.persist.FxmlLoadListener$ElementContext.endElement(FxmlLoadListener.java:1253)
      at com.oracle.javafx.authoring.persist.FxmlLoadListener.endElement(FxmlLoadListener.java:1825)
      at javafx.fxml.FXMLLoader.processEndElement(FXMLLoader.java:2434)
      at javafx.fxml.FXMLLoader.load(FXMLLoader.java:2136)
      at com.oracle.javafx.authoring.persist.FXMLDocument$1.call(FXMLDocument.java:164)
      at com.oracle.javafx.authoring.util.Utils.withFXMLDefaultClassLoader(Utils.java:2162)
      at com.oracle.javafx.authoring.persist.FXMLDocument.load(FXMLDocument.java:161)
      at com.oracle.javafx.authoring.persist.LoadFxml$2.call(LoadFxml.java:67)
      at com.oracle.javafx.authoring.persist.LoadFxml.loadElement(LoadFxml.java:150)
      at com.oracle.javafx.authoring.persist.LoadFxml.loadScreenData(LoadFxml.java:199)
      at com.oracle.javafx.authoring.Project.forFxml(Project.java:798)
      at com.oracle.javafx.authoring.Project.forFxml(Project.java:773)
      at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:164)
      at com.oracle.javafx.authoring.DesignerTool.loadFXMLLayout(DesignerTool.java:153)
      at com.oracle.javafx.authoring.ApplicationMenu$94.handle(ApplicationMenu.java:2739)
      at com.oracle.javafx.authoring.ApplicationMenu$94.handle(ApplicationMenu.java:2736)
      at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:69)
      at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:217)


            dfuchs Daniel Fuchs
            jcambon Jerome Cambon
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: