Home:ALL Converter>Text on java fx menu bar

Text on java fx menu bar

Ask Time:2016-02-23T19:33:21         Author:Piotr

Json Formatter

I'm writing app using JavaFx with fxml file for view. How can I add text on right side of menu (like on attached picture). Scene Builder allows me to add only Menu, but then the text is on the left (where the white box is) and I must disable this menu (because it is not menu). I also wanted to change the style of this menu, but it is not working. It is possible for only one menu?.

My fxml:

<?xml version="1.0" encoding="UTF-8"?>
<?import javafx.scene.control.Menu?>
<?import javafx.scene.control.MenuBar?>
<?import javafx.scene.control.MenuItem?>

<MenuBar xmlns="http://javafx.com/javafx/8.0.65" xmlns:fx="http://javafx.com/fxml/1" fx:controller="pl.controler.MainMenuController">
    <menus>
        <Menu fx:id="fileMenu" mnemonicParsing="false" text="%file">
            <items>
                <MenuItem fx:id="closeMenuItem" mnemonicParsing="false" text="%close" />
            </items>
        </Menu>
        <Menu fx:id="menuHelp" mnemonicParsing="false" text="%help">
            <items>
                <MenuItem fx:id="aboutMenuItem" mnemonicParsing="false" text="%about.title" />
            </items>
        </Menu>
      <Menu fx:id="loginName" mnemonicParsing="false" style="font-weight: bold; color: black;">
        <items>
          <MenuItem mnemonicParsing="false" text="Action 1" />
        </items>
      </Menu>
    </menus>
</MenuBar>

Attachment:

enter image description here

Author:Piotr,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/35576445/text-on-java-fx-menu-bar
yy