How to create toolbar with left, center and right sections in javaFX?

后端 未结 3 407
梦毁少年i
梦毁少年i 2021-01-13 04:08

I\'m trying to create a customized toolbar in javafx. This toolbar should be able to display controls in the center, in the left side and in the right side (three sections)

3条回答
  •  清酒与你
    2021-01-13 04:49

    Simply use a HBox instead of a StackPane. A StackPane puts Nodes on top of each other.

    See a modified example of your third attempt.

    Another option would be to use the FX ToolBar, similar to how jewelsea already mentioned:

    See an example using a ToolBar.

    Both attempts should be flexible enough for your needs. They differ in how much control you get over the layout and how many features you can inherit from the standard ToolBar.

提交回复
热议问题