Open popup(Menu) on task tray icon with left click using java

前端 未结 5 1206
难免孤独
难免孤独 2020-12-20 13:13

I am working on task tray Icon in java, I like to open a popup Menu using left click same popup Menu as I open on right click, and please help me with a quick response.

5条回答
  •  半阙折子戏
    2020-12-20 13:40

    you can add ActionListener to the TrayIcon, mouse double_click can showing JOptionPane

    trayIcon.addActionListener(new ActionListener() {
    
       @Override
       public void actionPerformed(ActionEvent e) {
           JOptionPane.showMessageDialog(null, "This dialog box is run from System Tray");
       }
    });
    

提交回复
热议问题