Trayicon mouseEntered无效

我有以下问题:我的鼠标输入方法不起作用,我不知道为什么。鼠标按下工作完美,只有鼠标没有。

这是鼠标收听者:

MouseListener mouseListener = new MouseListener() {

            public void mouseClicked(MouseEvent e) {
                jpopup.setLocation(e.getX(), e.getY());
                jpopup.setInvoker(jpopup);
                jpopup.setVisible(true);
                System.out.println("Tray Icon - Mouse clicked!");                 
            }
            @Override
            public void mouseEntered(MouseEvent e) {
                System.out.println("Tray Icon - Mouse entered!");                 
            }

            public void mouseExited(MouseEvent e) {
                System.out.println("Tray Icon - Mouse exited!");                 
            }

            public void mousePressed(MouseEvent e) {
                System.out.println("Tray Icon - Mouse pressed!");                 
            }

            public void mouseReleased(MouseEvent e) {
                System.out.println("Tray Icon - Mouse released!");                 
            }
        };

这里是trayIcon:

trayIcon.setImageAutoSize(true);
trayIcon.addActionListener(actionListener);
trayIcon.addMouseListener(mouseListener);

错误在哪里?我不知道...

编辑:我正在使用eclipse,如果这很有趣......

2

1 答案

4
额外