Kristianasp Kristianasp - 7 months ago 22
Java Question

Set MenuBar JavaFX "above" the actual frame

I am currently making a basic text editor with JavaFX. I'm trying to add a MenuBar so that you have a dropdown menu for File, Edit, View etc.

I tried using the MenuBar component from JavaFX, however this adds the menu bar directly to the frame. What I want is what happens with each application you install on a Macbook where the menu bar is "above" the actual program frame, like this example:

enter image description here

In the example, the menubar is on the same line as the Apple Icon together with "Sublime Text", "File" and so on.

How is this possible to do?

The text editor is primarily going to be used on a Macbook, so if there are any Macbook-only solutions, they are more than welcome.


Just call


on your menu bar. (See docs.)