From the course: Learning JavaFX GUI Development
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Include a menu
- [Voiceover] Most applications have some type of a menu where the menu is a list of actionable items. When you select one of the menu options it often provides the user with a submenu of items to choose from. Then an action is invoked when the user makes their selection. When creating menus in JavaFX, the first thing we need to do is identify the menu bar items. For example, in Netbeans, the menu bar contains things like File, Edit, View, Navigate, et cetera. Next, we'll define a list of menu items for each of the menu bar items. In Netbeans again, under File, the first two items are new project and new file. A menu object can also contain submenus and to separate menu items, you can use a separator, from the separator menu item class. It is important to note that the menu items are not considered nodes, and therefore cannot be added directly to the scene. Instead, we add the menu bar through the get menus method. Let's look at an example. Here is the start of a program that includes…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
(Locked)
Lay out a user interface5m 47s
-
(Locked)
Add controls to the user interface4m 35s
-
(Locked)
Use UI control event handlers6m 32s
-
(Locked)
Include a menu3m 48s
-
(Locked)
Provide a ListView for user selections4m 15s
-
(Locked)
Use a TableView to display data5m 37s
-
(Locked)
Challenge: Create a customer user interface challenge34s
-
(Locked)
Solution: Create a customer user interface challenge3m 50s
-
(Locked)
-
-
-