Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In java please, show the correct code and output, here is some code you need and

ID: 3862748 • Letter: I

Question

In java please, show the correct code and output, here is some code you need and will hlep.

i need this menubar.

(2) The MenuBar Add a Menubar to the FloorBuilderApp with a single menu named Select Floor. The menu should contain 5 Menultems, as well as a Separator Menultem and should look exactly as shown here in the image Notice that the names of the FloorPlan objects are to be shown in the menu (you MUST read these names from the FloorPlan objects, do not hard-code them in the menu code). Pay attention to the order of the floor plans as well. (Note that you will need to add about 20 pixels to your application's Scene height due to the added MenuBar). Floor plan Builder Select Floor 4th Floor JT 3rd Floor 2nd Floor Main Floor Basement

Explanation / Answer

This is how you can add menu in the application. You have to also create handlers to handle the clicks.

// code starts.

package menubar;


import javafx.application.Application;
import javafx.scene.Group;
import javafx.scene.Scene;
import javafx.scene.control.CustomMenuItem;
import javafx.scene.control.Menu;
import javafx.scene.control.MenuBar;
import javafx.scene.control.MenuItem;
import javafx.scene.control.SeparatorMenuItem;
import javafx.scene.control.Slider;
import javafx.scene.paint.Color;
import javafx.stage.Stage;


public class Menusample extends Application
{
MenuBar menuBar = new MenuBar();
Menu menu = new Menu("Select Floor");
MenuItem firstmenuitem = new MenuItem("4th Floor");
MenuItem thirdmenuitem = new MenuItem("3rd Floor");
MenuItem fourthmenuitem = new MenuItem("2nd Floor");
MenuItem firstsubmenu = new MenuItem("Main Floor");
MenuItem secondsubmenu = new MenuItem("Basement");


@Override
public void start(Stage fp)
{

menuBar.getMenus().add(menu);
menu.getItems().addAll(firstmenuitem,secondmenuitem,thirdmenuitem,fourthmenuitem,firstsubmenu,secondsubmenu);

Group root = new Group();
root.getChildren().add(menuBar);
menuBar.prefWidthProperty().bind(primaryStage.widthProperty());
Scene scene = new Scene(root, 300, 250,Color.PURPLE);

fp.setTitle("Floor Plan Builder");
fp.setScene(scene);
fp.show();
}


public static void main(String[] args)
{
launch(args);
}

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote