Code Monkey home page Code Monkey logo

Comments (5)

dwalluck avatar dwalluck commented on August 10, 2024

If you use the addMenuItem(javafx.scene.control.MenuItem) API, it always inserts at the end of the menu item list. But, there is also a insertMenuItem(javafx.scene.control.MenuItem, int) to insert at a menu item at a certain position.

from fxtrayicon.

dustinkredmond avatar dustinkredmond commented on August 10, 2024

Closing, considering the comment made by @dwalluck
I will consider implementing an index setting for the "Exit" item in future releases, though if you wanted to create your own custom "Exit" item, it simply calls Platform.setImplicitExit(true); Platform.exit();

from fxtrayicon.

EasyG0ing1 avatar EasyG0ing1 commented on August 10, 2024

@dlemmermann - There is already a Builder method for automatically adding an Exit menu to the bottom of the trayIcon - note the .addExitMenuItem() in this build sentence:

trayIcon = new FXTrayIcon.Builder(stage, getClass().getResource("FXIconRedYellow.png"))
		.toolTip("An alternative tooltip!")
		.menuItem(menuItemTest)
		.menuItem(menuOptions)
		.applicationTitle("FXTrayIcon Builder Text")
		.separator()
		.addExitMenuItem()
		.build();

I'm going to add the option of setting the label as desired in my next PR.

from fxtrayicon.

dwalluck avatar dwalluck commented on August 10, 2024

Maybe he wants additional methods that add a position index parameter, but I guess a builder is meant to only be called once and it adds the menus in called order.

from fxtrayicon.

EasyG0ing1 avatar EasyG0ing1 commented on August 10, 2024

@dwalluck The Builder does add the menuItems in the order that they are inserted into the build sentence. But the exitMenu can be added anywhere in the build sentence and it will always get placed at the bottom of the menu.

I also think that some kind of an indexing structure would be handy, I might start a new issue on that topic to open it up for some discussion as to how that should look from a usability perspective. I've got some ideas but it's always nice to get everyone's input on that kind of thing.

from fxtrayicon.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.