1

How can I add buttons using FXML to ControlsFX StatusBar?

This is how my status bar is created in my fxml:

<StatusBar fx:id="statusBar" onMouseEntered="#openSomething" onMouseExited="#closeSomething"/>

I saw I can add buttons to this status bar but I have no idea how to add buttons to the status bar via FXML. I tried adding buttons via java code and this works fine. Like this:

statusBar.getLeftItems().add(new Button("Info"));

But I want to add the via FXML.

Miss Chanandler Bong
  • 4,081
  • 10
  • 26
  • 36
Gregor
  • 409
  • 1
  • 5
  • 12

1 Answers1

4

Here is an example of a StatusBar in FXML:

<StatusBar fx:id="mainStatusBar" text="This is a StatusBar" progress=".314">
    <leftItems>
        <Button text="L Button 1"/>
        <Button text="L Button 2"/>
    </leftItems>
    <rightItems>
        <Button text="R Button"/>
        <ComboBox/>
    </rightItems>
    <graphic>
        <ImageView>
            <Image url="@/icons/sb.png"/>
        </ImageView>
    </graphic>
</StatusBar>
Miss Chanandler Bong
  • 4,081
  • 10
  • 26
  • 36