Submenus—One Last Feature
A submenu is a menu that drops down from a menu item. See Figure 19.39.
Figure 19.39
That’s right, menu items can be menus. Thus, if movies and cultMovies are both menus, that is, both belong to JMenu , then movies.add(cultMovies) creates a submenu such as the one displayed in Figure 19.39. Theoretically, there is no limit to the level of nested menus. Of course, more than two or three levels may be somewhat excessive.
Create a frame with a Format menu containing two submenus Color and Font. Pick four colors for the menu items of the Color menu and three fonts for the Font menu. The application should initially display a label Test Me, in a default font, on a white background. The font and the background should change as the user makes menu selections.
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here