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

MenuBar.lookup() and MenuBar.lookupAll() should search Menus/MenuItems (recursively)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • javafx

      MenuBar.lookup(String) and MenuBar.lookupAll(String) do not search the Menus and MenuItems added to it directly or indirectly, probably because they do not inherit from Node/Parent.
      Recursive lookup methods are useful for decoupling client code from the actual MenuBar tree structure. This will facilitate flexible and dynamic menus, which would otherwise require maintaining references to all the relevant MenuItems to avoid using brittle hard-coded train wrecks such as menuBar.getMenus().get(2).getItems().get(4).
      GUI unit testing would also greatly benefit from structure-independent lookup methods.

      A related issue is that lookup() and lookupAll() return a Node and a Set<Node>, respectively. Since MenuItem is not a subclass of Node, obviously MenuItem instances cannot be returned.

            Unassigned Unassigned
            duke J. Duke
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Imported: