Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

an unnatural focus event is killing MOUSE_RELEASE on XP  RSS feed

Eric Hoskland
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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..

Focus gained and 3 proper mouse events are fired
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??
Eric Hoskland
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
java.awt.SentEvent[] on
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.
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!