public static void drawDottedLine(@NotNull Graphics2D g,
                                    int x1,
                                    int y1,
                                    int x2,
                                    int y2,
                                    final @Nullable Color bgColor,
                                    final Color fgColor) {
    if (x1 == x2) {
      drawVDottedLine(g, x1, y1, y2, bgColor, fgColor);
    }
    else if (y1 == y2) {
      drawHDottedLine(g, x1, x2, y1, bgColor, fgColor);
    }
    else {
      throw new IllegalArgumentException("Only vertical or horizontal lines are supported");
    }
  }
public static void drawDottedLine(@NotNull Graphics2D g,
                                    int x1,
                                    int y1,
                                    int x2,
                                    int y2,
                                    final @Nullable Color bgColor,
                                    final Color fgColor)