在Mac上未触发JAVA mouseClicked事件 [英] JAVA mouseClicked event doesnt get fired on the Mac

查看:50
本文介绍了在Mac上未触发JAVA mouseClicked事件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我编写了一个包含两个使用mouseListeners的组件的程序:

I have written a program with two components that use mouseListeners:

  1. ResizeRectangle绘制带有手柄的矩形,并允许移动和调整矩形的大小.它处理MouseEvents和MouseMotionEvents(MouseMove,MousePressed,MouseDragged和MouseReleased).
  2. IconGrid在矩形内绘制图标网格,并允许选择(单击)图标.为此,它处理MouseClicked事件.

在Windows下一切正常.我今天尝试将程序移植到Mac,但是那里的MouseClicked事件从未触发过.我将MouseClicked事件放入ResizeRectangle中,但它也不会被触发.我将MouseReleased事件放在IconGrid中,但确实被触发了.因此,问题似乎确实与mouseClicked事件有关.

It all works fine under Windows. I tried to port the program to the Mac today, but there the MouseClicked event never gets fired. I put the MouseClicked event in ResizeRectangle, but there it also wont get fired. I put the MouseReleased event in IconGrid and that does get fired. So the problem really seems to be with the mouseClicked event.

我读了另一篇文章,指出在Mac上,即使在按下鼠标和释放鼠标之间进行很小的像素变化,也可能导致MouseClicked无法启动.但是,即使当我用鼠标悬空单击时(因此也没有机会在新闻和发布之间移动鼠标),mouseClicked事件也不会被触发.

I read another article that stated that on the Mac even a small pixel change between mouse press and mouse release would result in MouseClicked not being fired. But even when I click with my mouse in the air (so no chance of moving the mouse between the press and the release), the mouseClicked event doesnt get fired.

还有其他人有这个问题吗?这是Mac上的错误吗?

Anyone else had this problem? Is this a bug on the Mac?

推荐答案

找到错误的来源.我在虚拟机(VMWARE)中运行OSX,并选中了鼠标兼容性选项,这导致了MouseClicked事件的问题.对不起,麻烦了.

Got the source of the error. I run OSX in a virtual machine (VMWARE) and had a mouse compatibility option checked which caused the problem with the MouseClicked event. Sorry for the trouble.

这篇关于在Mac上未触发JAVA mouseClicked事件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆