How do I set a boolean for a specified amount of time, then reset it?

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

  •  26-10-2019
  •  | 
  •  

سؤال

I basically want a method I can call that will set a boolean to true for 2 seconds, then reset it to false. How would I do this?

I'm using the Slick library which is dependent on LWJGL.

هل كانت مفيدة؟

المحلول

You want to look at the Timer class.

نصائح أخرى

check out the ScheduledExecutorService and the method schedule()

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