the problem iam facing is that, my application has several screens and each screen change occurs after pressing <spacebar>, i have to execute a function xyz() that runs for 1 min at the 3rd screen. The problem is that while the func xyz() is exec. if someone presses the <spacebar> the keyevent getstored on the queue and as soon as the func exited it gets handled, how could i stop the events from being enqueued.
hi gourav, there is another way to stop listening to keystrokes using remove___listener ok this is the efficient way of handling events from V.R.Eswar varanasi_eswar2003@yahoo.com or varanasieswar@hotmail.com
i don't know how but this is happening that even after removing the listener when i re-add it it starts handeling all the previous events. i don't know but as soon as the handeler is added the handler starts handling the events that are fired in between the remove and the next add_listener(). i have solved the problem by consuming the events. but i'll be highly thankfull if u could tell me something about the disableEvents(). i have tried the above but wasn't successfull, i tried using it to disable keyevnts from delievering to the frame(the frame was also the listener).
the pseudo code was as follows:- class abc extends frame implements KeyListener,Mouselistener{ public abc(){ . . addKeylistener(this); . . addMouselistener(this); . . } public static void main(_){ . . . } . . public void keypressed(KeyEvent k){ _.println(k.toString()); } . . public void mouseclicked(Mouseevent me){ this.disableevnts(KeyEvent.KEY_EVENT_MASK); } . . }
after even clicking the frame the events are delivered to the frame.
Thanx for your patience and time and the nice suggestion.