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) xx -= 1; yy -= 1; LinePainter2D.paint(g, b.getX(), b.getY(), xx, b.getY(), StrokeType.CENTERED_CAPS_SQUARE, JBUIScale.scale(1f)); LinePainter2D.paint(g, xx, b.getY(), xx, yy, StrokeType.CENTERED_CAPS_SQUARE, JBUIScale.scale(1f)); LinePainter2D.paint(g, xx, yy, b.getX(), yy, StrokeType.CENTERED_CAPS_SQUARE, JBUIScale.scale(1f)); LinePainter2D.paint(g, b.getX(), yy, b.getX(), b.getY(), StrokeType.CENTERED_CAPS_SQUARE, JBUIScale.scale(1f)); return null; }