javaFX MenuBar


package fxmultimenu;

import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.control.*;
import javafx.scene.layout.*;
import javafx.event.ActionEvent;
import javafx.event.EventHandler;
import javafx.collections.*;
import javafx.stage.Stage;
import javafx.scene.text.Text.*;
import javafx.scene.paint.*;
import javafx.scene.text.*;
public class FxMultimenu extends Application {
	// labels
	Label l;

	// launch the application
	public void start(Stage s)
		// set title for the stage
		s.setTitle("creating MenuButton ");

		// create a tile pane
		TilePane r = new TilePane();

		// create a label
		Label l1 = new Label("This is a MenuButton example ");

		// create a menu button
		MenuButton m = new MenuButton("menuButton");

		// create menuitems
		MenuItem m1 = new MenuItem("menu item 1");
		MenuItem m2 = new MenuItem("menu item 2");
		MenuItem m3 = new MenuItem("menu item 3");

		// add menu items to menu

		// create a tilepane
		TilePane vb = new TilePane(l1, m);

		// create a scene
		Scene sc = new Scene(vb, 200, 200);

		// set the scene

	public static void main(String args[])
		// launch the application

Leave a Reply