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

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

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P4
    • fx2.1
    • fx2.0.2, fx2.1, 7-pool
    • javafx

    Description

      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.

      Attachments

        Activity

          People

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

            Dates

              Created:
              Updated:
              Resolved:
              Imported: