Trayicon mouseEntered无效

时间:2012-06-18 15:45:02

标签: java mouseenter trayicon

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

这是鼠标收听者:

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,如果这很有趣......