public static void paintWithAA(@NotNull Graphics2D g, @NotNull Object valueAA, @NotNull Runnable paint) {
    if (valueAA == RenderingHints.VALUE_ANTIALIAS_DEFAULT) {
      paint.run();
      return;
    }
    Object key = g.getRenderingHint(RenderingHints.KEY_ANTIALIASING);
    g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, valueAA);
    try {
      paint.run();
    } finally {
      g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, key);
    }
  }
public static void paintWithAA(@NotNull Graphics2D g, @NotNull Object valueAA, @NotNull Runnable paint)