Most of us use painter's tape when painting around windows or window frames, and it works, unless you have an oddly-shaped window or frame (like a circular or cut-glass window.) In that case, a thin layer of lip balm at the edges of the glass lets you paint freely and just wipe away the excess.
You can just rub it onto the glass surface, or use a cotton swab to get the balm close to the edge of the glass. Extend the layer out about half an inch from the edge to make sure it catches as much paint as possible. Once you're ready to clean up, simply wipe the balm (and paint on top of it) off with a dry paper towel. This method works well for unusually shaped windows, but you can also use it for any window if you don't have (or ran out of) painter's tape.