To create ToolBar in JavaFX
// Create the tool bar. ToolBar toolBar = new ToolBar(btnSet, btnClear, btnResume); rootNode.setCenter(response); rootNode.setTop(toolBar);
Full source
import javafx.application.Application; import javafx.scene.Scene; import javafx.scene.control.Button; import javafx.scene.control.ContentDisplay; import javafx.scene.control.Label; import javafx.scene.control.ToolBar; import javafx.scene.control.Tooltip; import javafx.scene.image.ImageView; import javafx.scene.layout.BorderPane; import javafx.stage.Stage; public class Main extends Application { //Create a label that will report the selection. private Label response = new Label("Menu Demo"); public static void main(String[] args) { launch(args);//ww w . j a v a 2s .c om } public void start(Stage myStage) { myStage.setTitle("Menus from java2s.com"); // Use a BorderPane for the root node. BorderPane rootNode = new BorderPane(); Scene myScene = new Scene(rootNode, 300, 300); myStage.setScene(myScene); // Create tool bar items. Button btnSet = new Button("Set", new ImageView("set.gif")); Button btnClear = new Button("Clear", new ImageView("clear.gif")); Button btnResume = new Button("Resume", new ImageView("resume.gif")); // Turn off text in the buttons. btnSet.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); btnClear.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); btnResume.setContentDisplay(ContentDisplay.GRAPHIC_ONLY); // Set tooltips. btnSet.setTooltip(new Tooltip("Set a breakpoint.")); btnClear.setTooltip(new Tooltip("Clear a breakpoint.")); btnResume.setTooltip(new Tooltip("Resume execution.")); // Create the tool bar. ToolBar toolBar = new ToolBar(btnSet, btnClear, btnResume); rootNode.setCenter(response); rootNode.setTop(toolBar); myStage.show(); } }