O'Reilly logo

NetBeans IDE 8 Cookbook by Rhawi Dantas, David Salter

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating menus

Now that we've created a basic GUI for our application, let's add a menu structure so that we can close the application easily and view the application's About box.

Getting ready

To complete this recipe, we need to have the JarViewer project that was created in the Adding components to a form recipe. If you have not completed this recipe, the source code is available with the code download bundle for this chapter.

How to do it…

To add a menu to an application, we need to have the main form of the application open for editing in the design view. We then drag-and-drop a menu bar and menu items from the Palette section onto the form. Let's see how that can be achieved with the following steps:

  1. Double-click on the MainFrame.java file within ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required