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
Post a Comment