In Java, Can I have a routine called every time the event-dispatch-thread returns from handling an input event?

StackOverflow https://stackoverflow.com/questions/5932518

سؤال

I am working on a GUI, and I have a routine to update the display when things change underneath:

void update() {
    if (needsUpdating) {
        // ...
        needsUpdating = false;
    }
}

I'm trying to avoid calling update() "too often" -- ie, if many properties are set in succession I'd rather update() be called just once.

Is it possible to have update() called after every user input event -- key/mouse/etc? I could do this manually, but I have so many event handlers and I know I'll forget -- can Java do this for me?

لا يوجد حل صحيح

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top