Add a helper method to Util - findComponent()

XMLWordPrintable

    • Fix Understood
    • generic
    • generic

      Add the following helper method in Util

          private static Component findComponent(final Container container,
                                                 final Predicate<Component> predicate) {
              for (Component child : container.getComponents()) {
                  if (predicate.test(child)) {
                      return child;
                  }
                  if (child instanceof Container cont && cont.getComponentCount() > 0) {
                      Component result = findComponent(cont, predicate);
                      if (result != null) {
                          return result;
                      }
                  }
              }
              return null;
          }

            Assignee:
            Harshitha Onkar
            Reporter:
            Harshitha Onkar
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated: