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
A bug? Or am I doing something wrong? #57
Comments
@KacyBiscuit Try using the Builder class of FXTrayIcon, like this:
It should put everything in the order that you have them placed in your build sentence. Also, when you add any item to an existing FXTrayIcon, the library will verify that the label String assigned to the item does not already exist in the trayMenu, and if it does, it will throw an error. |
@KacyBiscuit - It's been a while since you opened this incident, have the comments I made been of any use to you? |
So sorry for the long reply! I had thought I'd replied before but I must've forgot as I've been busy recently, that helped greatly thanks! although I don't entirely understand the second part of your message as when I'm adding them they definately don't already exist so I don't see why it should throw an error |
What I mean by saying "when you add any item to an existing FXTrayIcon" - I'm talking about after you have already created an instance of FXTrayIcon, and then you add menuItems into it (as opposed to adding all of your menuItems in your build sentence). The only point I was trying to make, is that FXTrayIcon checks the label of every menuItem that you place into FXTrayIcon, and if it sees that the words in the label have already been used, then it will throw an error. This example should make it clearer: Let's say that I create a new instance of FXTI FXTrayIcon trayIcon = new FXTrayIcon.Builder(stage, iconImage, imageWidth, imageHeight)
.menuItem("Open File", e-> openFile())
.menuItem("Close File", e-> closeFile())
.separator()
.addExitMenuItem("Exit", e-> closeProgram())
.show(); Then after that object is already created, I then try to do something like this: MenuItem openFile = new MenuItem("Open File");
openFile.setOnAction(e -> openFile());
trayIcon.addMenuItem(openFile); FXTrayIcon will throw an error because it already has a menuItem with the label Does that make sense? I wasn't saying necessarily that you were trying to do this, I was just pointing out that if you were, then you would get an error ... that's all I was saying. |
Has this issue been resolved? |
so sorry, it has been but ive been logged out of github for a while so i havnt been receaving notifications |
best of luck! |
Menus appear to be getting added to the list in the wrong order.
This code:
creates this menu:
For some reason the menu dictionary is between "Show" and "Hide to Tray" when it should come just before the second separator.
Also this warning appears in the console, but I don't understand why as they are only added once.
The text was updated successfully, but these errors were encountered: