"Build Automatically" function with Swing
How should I implement a function like th开发者_开发百科at on my Swing editor?
I was thinking of a thread started on a releaseKey
event. This thread should have a timer of a second. Every time I have the releaseKey
I either start the thread or just reset the timer if it is already running.
I'm not convinced though. It seems like too heavy on the UI.
How should I do it?
A Timer starting/stopping every second is not a big weight on the UI at all. The "building" is what is going to possibly take some time. I think looking for a pause in keystokes is a fine solution.
精彩评论