user interface - Temporarily disable key input java -


i working on basic game uses timers jprogressbars add filling effect character stats. 1 problem run if character selected before progress bars filled, causes graphics overlap , buggy. timers connected jbuttons via custom action class, , buttons can navigated via keys. want disable key input when action begins, , re-enable keys when longest timer finishes. if code helpful ask , upload file. , appreciated.

without seeing code difficult find out fix. if timers threads, maybe thread group useful. how this:

public class mywindow {     integer numtimersrunning = 0;     ...     {             // timer started here             numtimersrunning++;             //timer thing , makes progress bars go up.             ...             //timer finishes             numtimersrunning--;     }      void keypressed(mouseevent e) {      if(numtimersrunning > 0)                return;      // keyboard input processing....     } } 

i dunno shot in dark, luck.

ps: sounds might encoutering double buffering issued. check out http://docs.oracle.com/javase/tutorial/extra/fullscreen/doublebuf.html


Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -