Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8328281

TrayIcon getClickCount() always 1 in some Linux environments

XMLWordPrintable

    • x86_64
    • linux

      A DESCRIPTION OF THE PROBLEM :
      For double-clicks or other repeated clicks on TrayIcons, MouseEvent.getClickCount() incorrectly returns 1.

      I found this problem only in some environments:
      - Bugged: KDE Plasma; LXQT
      - Working: LXDE; XFCE; Microsoft Windows


      ---------- BEGIN SOURCE ----------
      import java.awt.SystemTray;
      import java.awt.TrayIcon;
      import java.awt.event.MouseAdapter;
      import java.awt.event.MouseEvent;
      import java.awt.image.BufferedImage;

      class TrayClickCount {
          public static void main(String[] args) throws Throwable {
              BufferedImage black = new BufferedImage(32, 32, BufferedImage.TYPE_INT_RGB);
              TrayIcon ti = new TrayIcon(black);
              
              ti.addMouseListener(new MouseAdapter() {
                  @Override
                  public void mouseClicked(MouseEvent e) {
                      System.out.println("Button " + e.getButton() + "; Click count: " + e.getClickCount());
                  }
              });
              
              SystemTray.getSystemTray().add(ti);
          }
      }
      ---------- END SOURCE ----------

      FREQUENCY : always


            Unassigned Unassigned
            webbuggrp Webbug Group
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated: