• Post Reply Bookmark Topic Watch Topic
  • New Topic

Problems with mouse events on MAC and XP PRO

 
Eric Hoskland
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So I have a frame with some buttons and a big textarea. The buttons all work fine and everything is normal until I change focus to something outside the java program. So if I click on the desktop or another program then back to the textarea then the program acts like I'm holding the left mouse button down so it keeps highlighting text and I can't click on any of the buttons.
It's probably a long shot but does anyone have any ideas???
Thanks
Eric
[ September 26, 2003: Message edited by: Eric Hoskland ]
 
kyle amburn
Ranch Hand
Posts: 64
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Without seeing your code, here are a couple of questions:
1. What Component is the MouseEvent registered with? If it is registered with the frame, then when you click on the frame to give it focus you may be inadvertently firing a mouse event.
2. What action are you testing (i.e. mouseClicked)?
3. If everything seems to be okay in your mouse event code, then you could play with the window focus events and set variables that clears and only allows a new mouse event after the window regains focus.
Kyle
 
Eric Hoskland
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok here's some insight into the issue. What I did was override the dispatchEvent method and then printed out to a file every single event that occurs. Now on a working system I get the following output (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,clickCount=1
MOUSE_RELEASED,(11,8),button=1,modifiers=Button1,clickCount=1
MOUSE_CLICKED,(11,8),button=1,modifiers=Button1,clickCount=1
NOW on the non-functioning win XP PRO system I get the following results:
WINDOW_ACTIVATED
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=null,catchExceptions=false
MOUSE_MOVED,(353,220),mods=0,clickCount=0
It gains focus twice for some reason and then it never fires off the MOUSE_RELEASED event. Why is Java not getting the message that the mouse has been released???
 
Eric Hoskland
Greenhorn
Posts: 29
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there a way for me to force a mouse released event through code?
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!