Swing rate limiting
问题 I have a long repaint operation that I would like to rate-limit, ie make sure it gets called once every N milliseconds at most. My current solution is somewhat unsatisfactory: I use a Swing Timer with a short duration, which I restart() whenever I get an event. This make sure that a repaint is not triggered if events happen within an N milliseconds window (i.e. the repaint will happen after an event and an N milliseconds "quiet" period has elapsed). What I would like is to make sure the