I had this question posted at the end of a different post but seeing as how this question is a little different then the previous one I figured I'd make a whole new post out of it. If this was bad I'm sorry. I only have this error being reported from people with XP PRO. So I overrode the dispatchEvent method so that I could monitor every event that was occuring because for some reason when a window lost focus then gained focus java acted like the mouse was still held down. These are the results I found: So this is in reference to a TEXT_AREA. A person clicks on the desktop so the text_area has lost focus and then they click back on the text_area. Below are the events that are fired when the user clicks back on the text_area and it regains focus..
WIN98 WORKING: WINDOW_ACTIVATED,opposite=null,oldState=0,newState=0 WINDOW_GAINED_FOCUS,opposite=null,oldState=0,newState=0 FOCUS_GAINED,permanent,opposite=null MOUSE_PRESSED,(11,8),button=1,modifiers=Button1,extModifiers=Button1,clickCo unt=1 MOUSE_RELEASED,(11,8),button=1,modifiers=Button1,clickCount=1 MOUSE_CLICKED,(11,8),button=1,modifiers=Button1,clickCount=1 Focus gained and 3 proper mouse events are fired NOW WINXP PRO: FOCUS_GAINED,permanent MOUSE_PRESSED,(353,221),mods=16,clickCount=1 FOCUS_LOST,permanent FOCUS_GAINED,permanent MOUSE_CLICKED,(353,221),mods=16,clickCount=1 INVOCATION_DEFAULT,runnable=sun.awt.GlobalCursorManager$1@3e0e27,notifier=nu ll,catchExceptions=false MOUSE_MOVED,(353,220),mods=0,clickCount=0 MOUSE_MOVED,(352,218),mods=0,clickCount=0 Focus is gained, mouse is pressed, then focus is lost??? then immediately gained??? and then mouse is clicked. The mouse released never gets fired thus when I move the mouse around the text field it just highlights things as if I'm holding down the mouse button. Somewhere in that odd gain and then focus the event is getting lost. ideas?? or workarounds??
Joined: Oct 12, 2000
Ok I found a little more out about the focus events. I have a class called AsmEditWindow that extends Frame. In this frame I have two different TextAreas, each of these textAreas have there own separate focus listeners that I've set up using inner classes. So like: msgarea.addFocusListener(new MsgAreaFocusListener()); textarea.addFocusListener(new TextAreaFocusListener()); Now on the functioning windows 98 system I Get: java.awt.event.FocusEvent[FOCUS_GAINED,permanent,opposite=null] on text0 java.awt.SequencedEvent on text0 java.awt.event.MouseEvent[MOUSE_PRESSED,(11,8),button=1,modifiers=Button1,extModifiers=Button1,clickCount=1] on text0 java.awt.SentEvent on sun.awt.windows.WToolkit@11946c2 java.awt.SentEvent on sun.awt.windows.WToolkit@11946c2 java.awt.event.MouseEvent[MOUSE_RELEASED,(11,8),button=1,modifiers=Button1,clickCount=1] on text0 The first focus event is on text0 then the mouse listeners proceed without a problem. On the non-functioning windows XP system I get: java.awt.event.FocusEvent[FOCUS_GAINED,permanent] on frame1 java.awt.event.MouseEvent[MOUSE_PRESSED,(353,221),mods=16,clickCount=1] on text0 java.awt.event.FocusEvent[FOCUS_LOST,permanent] on frame1 java.awt.event.FocusEvent[FOCUS_GAINED,permanent] on text0 So frame1 gains, then mouse is pressed, then frame 1 loses and text0 gains focus and the mouse_release event never gets thrown. Is there something more that I should be posting to give insight? The code section to setup the Frame is about 95 lines so I was thinking that was too long to put in the post. If this assumption is incorrect tell me what part of the code would be useful, and I'll post it. Thanks