-
Bug
-
Resolution: Duplicate
-
P4
-
None
-
9
-
OS X 10.8.5
Need to evaluate whether it is a bug or OS specific behavior.
OS X. Created java.awt.TrayIcon does not handle mouseMoved event if the corresponding listener is added to it.
It could be not a bug, likeJDK-6827035 on Windows
To reproduce run the following test:
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
public class OSXMouseMovedTest {
static boolean moved;
public static void main(String[] args) throws Exception {
moved = false;
TrayIcon icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_3BYTE_BGR), "Test icon");
icon.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseMoved(MouseEvent event) {
moved = true;
System.out.println("Mouse moved");
}
});
SystemTray.getSystemTray().add(icon);
Robot robot = new Robot();
robot.mouseMove(0, 13);
double width = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
for (double i = width / 2; i <= width; i++){
robot.mouseMove((int) i, 13);
robot.delay(7);
}
if (!moved)
throw new RuntimeException("Mouse moved action did not trigger");
}
}
OS X. Created java.awt.TrayIcon does not handle mouseMoved event if the corresponding listener is added to it.
It could be not a bug, like
To reproduce run the following test:
import java.awt.*;
import java.awt.event.*;
import java.awt.image.BufferedImage;
public class OSXMouseMovedTest {
static boolean moved;
public static void main(String[] args) throws Exception {
moved = false;
TrayIcon icon = new TrayIcon(new BufferedImage(20, 20, BufferedImage.TYPE_3BYTE_BGR), "Test icon");
icon.addMouseMotionListener(new MouseMotionAdapter() {
public void mouseMoved(MouseEvent event) {
moved = true;
System.out.println("Mouse moved");
}
});
SystemTray.getSystemTray().add(icon);
Robot robot = new Robot();
robot.mouseMove(0, 13);
double width = Toolkit.getDefaultToolkit().getScreenSize().getWidth();
for (double i = width / 2; i <= width; i++){
robot.mouseMove((int) i, 13);
robot.delay(7);
}
if (!moved)
throw new RuntimeException("Mouse moved action did not trigger");
}
}
- duplicates
-
JDK-7153700 [macosx] add support for MouseMotionListener to the TrayIcon
-
- Resolved
-
- relates to
-
JDK-6827035 mousePressed not triggered when BUTTON1 pressed as normally on Win7
-
- Closed
-