Point2D (@NotNull JComponent comp) { if (!comp.isShowing() || !isFractionalScale(comp.getGraphicsConfiguration().getDefaultTransform())) return new Point2D.Double(); int x = 0; int y = 0; while (!(comp instanceof JRootPane) && comp != null) { x += comp.getX(); y += comp.getY(); comp = (JComponent)comp.getParent(); } double scale = JBUIScale.sysScale(comp); double sx = x * scale; double sy = y * scale; return new Point2D.Double((sx - (int)sx) / scale, (sy - (int)sy) / scale); }