Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Menu Not Appearing on Windows in SystemTray #209

Open
kdroidFilter opened this issue Feb 13, 2024 · 6 comments
Open

Menu Not Appearing on Windows in SystemTray #209

kdroidFilter opened this issue Feb 13, 2024 · 6 comments

Comments

@kdroidFilter
Copy link

Hello,

I'm encountering an issue with the SystemTray library on a Windows environment where the tray menu fails to appear. Below are the details of my setup and the steps to reproduce the issue:

Expected Behavior: A tray icon appears in the Windows system tray, with an accessible menu on right-click.

Actual Behavior: The tray icon appear in the system tray, but no menu is accessible.

Any assistance or suggestions on how to resolve this issue would be greatly appreciated. Thank you for your help.

Best regards,

@gmseed
Copy link

gmseed commented Feb 14, 2024

I use this library on a Win/Linux/Apple app and also found that on one user's Win machine the system tray didn't appear. It appears on my machine and other machines tested on but for one user's setup it didn't show and actually caused a crash. I'm using Java 8/21 and JavaFX and what I ended up doing was adding an if-statement and if Win then use the standard Java system tray, else use this 3rd-party lib. The reason I used this lib in the first place was due to the system tray not appearing on Linux Ubuntu/Mint machines, which is well-known. So, in my case the system tray not appearing on Win was never an issue but became one by relying entirely on this lib. And so why I added an if-clause.

@dorkbox
Copy link
Owner

dorkbox commented Feb 14, 2024

Hey there,

Can you get me an output of the application running with SystemTray.DEBUG = true ?

I’ve run and tested this extensively on (pretty much) every version of Windows and it shouldn’t have any problems. The test examples are what I use to validate it.

@dorkbox
Copy link
Owner

dorkbox commented Feb 14, 2024

I use this library on a Win/Linux/Apple app and also found that on one user's Win machine the system tray didn't appear. It appears on my machine and other machines tested on but for one user's setup it didn't show and actually caused a crash.

Are you able to get me a stack-trace of the crash?

@gmseed
Copy link

gmseed commented Feb 14, 2024

"Are you able to get me a stack-trace of the crash?" --> unfortunately not. When it was reported the user was seeing a crash on Win I similarly requested a stacktrace but never received one. I think they had a very specific setup that was causing the problem.

@kdroidFilter
Copy link
Author

kdroidFilter commented Feb 20, 2024

Hi,
it's the output :
12:03:43.688 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- Version 4.4 12:03:43.690 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- OS: Windows 10 12:03:43.690 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- Arch: amd64 12:03:43.690 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- Oracle Corporation Java HotSpot(TM) 64-Bit Server VM 17.0.10 12:03:43.690 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- JPMS enabled: true 12:03:43.690 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- Is Auto sizing tray/menu? true 12:03:43.691 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- Is JavaFX detected? false 12:03:43.691 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- Is SWT detected? false 12:03:43.692 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- Java Swing L&F: Windows 12:03:43.693 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- Auto-detecting tray type 12:03:43.711 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- Tray indicator image size: 20 12:03:43.711 [AWT-EventQueue-0] DEBUG dorkbox.systemTray.SystemTray -- Tray menu image s12:03:43.916 [AWT-EventQueue-0] INFO dorkbox.systemTray.SystemTray -- Successfully loaded type: _WindowsNativeTray 12:03:49.469 [WindowsEventDispatch_0] ERROR dorkbox.jna.windows.WindowsEventDispatch -- Error during listener execution. java.lang.NullPointerException: Cannot read field "y" because "bounds" is null at dorkbox.systemTray.ui.swing.TrayPopup.doShow(TrayPopup.java:126) at dorkbox.systemTray.ui.swing._WindowsNativeTray$4.run(_WindowsNativeTray.java:211) at dorkbox.jna.windows.WindowsEventDispatch$1.callback(WindowsEventDispatch.java:166) at dorkbox.jna.windows.User32_64.GetMessage(Native Method) at dorkbox.jna.windows.WindowsEventDispatch.run(WindowsEventDispatch.java:190) at java.base/java.lang.Thread.run(Thread.java:842) 12:03:50.832 [WindowsEventDispatch_0] ERROR dorkbox.jna.windows.WindowsEventDispatch -- Error during listener execution. java.lang.NullPointerException: Cannot read field "y" because "bounds" is null at dorkbox.systemTray.ui.swing.TrayPopup.doShow(TrayPopup.java:126) at dorkbox.systemTray.ui.swing._WindowsNativeTray$4.run(_WindowsNativeTray.java:211) at dorkbox.jna.windows.WindowsEventDispatch$1.callback(WindowsEventDispatch.java:166) at dorkbox.jna.windows.User32_64.GetMessage(Native Method) at dorkbox.jna.windows.WindowsEventDispatch.run(WindowsEventDispatch.java:190) at java.base/java.lang.Thread.run(Thread.java:842)
It's work very well on Ubuntu, and not tested it on mac.
Thanks a lot

@westboy
Copy link

westboy commented Jul 16, 2024

https://github.com/dorkbox/OS/blob/master/src/dorkbox/os/OS.kt

I temporarily modified the method for extracting the Windows version.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants