KeyCombination needs a valueOf() method to be used in FXML

XMLWordPrintable

    • Type: Bug
    • Resolution: Fixed
    • Priority: P4
    • fx2.1
    • Affects Version/s: fx2.0.2, fx2.1, 7-pool
    • Component/s: javafx

      I'm trying to represent a MenuItem in FXML, and have successfully done so with the exception of the accelerator key:

                  MenuItemBuilder.create()
                    .text("New...")
                    .graphic((new ImageView(
                      new Image(getClass().getResourceAsStream("images/paper.png"))))
                    )
                    .accelerator(KeyCombination.keyCombination("Ctrl+N"))
                    .build(),

      Feedback from Greg Brown:
      Looks like KeyCombination needs a valueOf() method. When a class defines a static valueOf() method, you can do this in FXML:

      <KeyCombination fx:value="Ctrl+N"/>

      The existing implementation of keyCombination() could delegate to valueOf(), or vice versa, to maintain backward compatibility.

            Assignee:
            Greg Brown (Inactive)
            Reporter:
            Jim Weaver (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: