static void drawOnActiveFrameGraphics(Consumer<? super Graphics2D> consumer) {
    Arrays.stream(Frame.getFrames()).
      filter(window -> window instanceof RootPaneContainer).
            filter(f -> f.isActive()).
            map(window -> (RootPaneContainer)window).
            filter(w -> w instanceof JFrame).
            filter(f -> f.getRootPane() != null).
            filter(f -> f.getGlassPane() != null).
            filter(window -> window.getRootPane() != null).
            map(window -> (window).getGlassPane()).
            map(jGlassPane -> jGlassPane.getGraphics()).
            filter(g -> g != null).
            forEach(graphics -> {
              Graphics glassPaneGraphics = graphics.create();
              try {
                consumer.accept((Graphics2D)glassPaneGraphics);
              } finally {
                glassPaneGraphics.dispose();
              }
            });
  }
static void drawOnActiveFrameGraphics(Consumer<? super Graphics2D> consumer)