Void (Graphics2D g) { Rectangle2D b = rectBounds(g); double x = b.getX(); double y = b.getY(); double xx = x + b.getWidth(); double yy = y + b.getHeight(); // the rect right/bottom edge is painted at x + width - 1/y + height - 1 (unlike in Graphics.drawRect) double _xx = xx - 1; double _yy = yy - 1; LinePainter2D.paint(g, b.getX(), b.getY(), _xx, b.getY(), StrokeType.INSIDE, JBUIScale.scale(1f)); LinePainter2D.paint(g, xx, b.getY(), xx, _yy, StrokeType.OUTSIDE, JBUIScale.scale(1f)); LinePainter2D.paint(g, _xx, yy, b.getX(), yy, StrokeType.OUTSIDE, JBUIScale.scale(1f)); LinePainter2D.paint(g, b.getX(), _yy, b.getX(), b.getY(), StrokeType.INSIDE, JBUIScale.scale(1f)); return null; }