void (@NotNull Graphics2D g, int x1, int y1, int x2, int y2, @Nullable Color bgColor, @Nullable Color fgColor) { Color oldFg = g.getColor(); Color oldBg = g.getBackground(); if (fgColor != null) { g.setColor(fgColor); } if (bgColor != null) { g.setBackground(bgColor); } LinePainter2D.paint(g, x1, y1, x2, y2); if (fgColor != null) { g.setColor(oldFg); } if (bgColor != null) { g.setBackground(oldBg); } }