https://bugs.kde.org/show_bug.cgi?id=495064

            Bug ID: 495064
           Summary: Java AWT TrayIcon stopped working on KDE 6.6 Plasma
    Classification: Plasma
           Product: xdg-desktop-portal-kde
           Version: unspecified
          Platform: Ubuntu
                OS: Linux
            Status: REPORTED
          Severity: critical
          Priority: NOR
         Component: general
          Assignee: plasma-b...@kde.org
          Reporter: perini.dav...@dpsoftware.org
                CC: aleix...@kde.org
  Target Milestone: ---

Running Ubuntu 24.10 and KDE 6.6 Plasma.
Java TrayIcon stopped working.

With this simple code:
```
import java.awt.*;
import java.awt.event.*;

public class TrayIconExample {
    public static void main(String[] args) {
        if (SystemTray.isSupported()) {
            SystemTray tray = SystemTray.getSystemTray();
            Image image = Toolkit.getDefaultToolkit().createImage("icon.png");
            TrayIcon trayIcon = new TrayIcon(image, "Tray Demo");

            trayIcon.setImageAutoSize(true);
            trayIcon.setToolTip("Tray Icon Demo");

            trayIcon.addMouseListener(new MouseAdapter() {
                u/Override
                public void mouseClicked(MouseEvent e) {
                    if (e.getButton() == MouseEvent.BUTTON1) {
                        System.out.println("Left button clicked");
                    } else if (e.getButton() == MouseEvent.BUTTON3) {
                        System.out.println("Right button clicked");
                    } else if (e.getButton() == MouseEvent.BUTTON2) {
                        System.out.println("Middle button clicked");
                    }
                }
            });

            try {
                tray.add(trayIcon);
            } catch (AWTException e) {
                System.err.println("TrayIcon could not be added.");
            }
        } else {
            System.err.println("System tray not supported!");
        }
    }
}
```

Tray icon is correctly added to the tray bar but there is no way to listen to
mouse button on it making it unusable.

No event is triggered when I click on the tray icon.

This issue is blocking making all Java programs that uses a tray icon to not
work correcly.

-- 
You are receiving this mail because:
You are watching all bug changes.

Reply via email to