Starting Out with Java: From Control Structures through Objects (6th Edition)
Starting Out with Java: From Control Structures through Objects (6th Edition)
6th Edition
ISBN: 9780133957051
Author: Tony Gaddis
Publisher: PEARSON
bartleby

Videos

Expert Solution & Answer
Book Icon
Chapter 13, Problem 11AW

Explanation of Solution

Menu Bar:

  • It is used to create a menu bar.
    • The menu bar is placed at the top of window.
    • The menu bar lists the one or more menu names.
  • The menu bar object is able to handle menu objects.
    • Create the needed menu objects, and add them to the object of menu bar.
  • User can create the menu bar using “JMenuBar” class.

Menus:

  • Menus is used to create a drop-down list menu items.
    • User can create a menu using “JMenu” class.
  • A menu can contain
    • Menu items – it is used to create an ordinary menu item.
      • User can create a menu items using “JMenuItem” class.
    • Checked menu items – it is used to create a check menu item.
      • User can create a checked menu item using “JCheckMenuItem” class.
    • Radio button menu items – it is used to create a radio button menu item.
      • User can create a radio button menu items using “JRadioButtonMenuItem” class.
    • Other menus.

Mnemonics:

  • A mnemonics is a key on the keyboard.
    • Clicking a button using mnemonic.
    • To click a button, user can press keyboard in combination with the “Alt” key.
    • It is also referred to as “shortcut keys”, “access keys”, or “hot keys”.
  • User can assign a mnemonic to a component using the component method called “setMnemonic”.
    • This method takes the parameter of “key” that is by using “KeyEvent” class. Example for this “KeyEvent.VK_x”.
      • “VK” is the virtual key and in the place of “x” user need to put a key on the keyboard.
      • After creating this, user may click the given button by using “+x” on the keyboard.

Creating a menu bar with one menu:

//Create a menu item for Open

JMenuItem openMenuItem = new JMenuItem("Open");

//Assign mnemonic for open menu item

openMenuItem.setMnemonic(KeyEvent.VK_O);

//Register action listener for Open menu item

openMenuItem.addActionListener(new OpenListener());

//Create a menu item for Print

JMenuItem printMenuItem = new JMenuItem("Print");

//Assign mnemonic for print menu item

printMenuItem...

Blurred answer

Chapter 13 Solutions

Starting Out with Java: From Control Structures through Objects (6th Edition)

Ch. 13.6 - Prob. 13.11CPCh. 13.8 - Prob. 13.12CPCh. 13.8 - Prob. 13.13CPCh. 13.8 - Prob. 13.14CPCh. 13.8 - Prob. 13.15CPCh. 13.8 - Prob. 13.16CPCh. 13.8 - Prob. 13.17CPCh. 13.8 - Prob. 13.18CPCh. 13.8 - 13.19 How do you place a menu bar in a JFame ? Ch. 13.8 - Prob. 13.20CPCh. 13.8 - Prob. 13.21CPCh. 13.8 - Prob. 13.22CPCh. 13.9 - Prob. 13.23CPCh. 13.9 - Prob. 13.24CPCh. 13.9 - Prob. 13.25CPCh. 13.9 - Prob. 13.26CPCh. 13.9 - Prob. 13.27CPCh. 13.9 - Prob. 13.28CPCh. 13.10 - Prob. 13.29CPCh. 13.10 - Prob. 13.30CPCh. 13 - Prob. 1MCCh. 13 - Prob. 2MCCh. 13 - Prob. 3MCCh. 13 - Prob. 4MCCh. 13 - Prob. 5MCCh. 13 - Prob. 6MCCh. 13 - Prob. 7MCCh. 13 - Prob. 8MCCh. 13 - Prob. 9MCCh. 13 - Prob. 10MCCh. 13 - Prob. 11MCCh. 13 - Prob. 12MCCh. 13 - Prob. 13MCCh. 13 - Prob. 14MCCh. 13 - You use this class to create a menu bar. a....Ch. 13 - Prob. 16MCCh. 13 - Prob. 17MCCh. 13 - Prob. 18MCCh. 13 - Prob. 19MCCh. 13 - Prob. 20MCCh. 13 - Prob. 21MCCh. 13 - Prob. 22TFCh. 13 - Prob. 23TFCh. 13 - Prob. 24TFCh. 13 - Prob. 25TFCh. 13 - Prob. 26TFCh. 13 - Prob. 27TFCh. 13 - Prob. 28TFCh. 13 - Prob. 29TFCh. 13 - Prob. 30TFCh. 13 - Prob. 31TFCh. 13 - Prob. 32TFCh. 13 - Prob. 33TFCh. 13 - Prob. 34TFCh. 13 - Prob. 35TFCh. 13 - Prob. 1FTECh. 13 - Prob. 2FTECh. 13 - Prob. 3FTECh. 13 - Prob. 4FTECh. 13 - Prob. 5FTECh. 13 - 6. // Add a menu to the menu bar; JMenuBar menuBar...Ch. 13 - Prob. 7FTECh. 13 - Prob. 1AWCh. 13 - Prob. 2AWCh. 13 - Prob. 3AWCh. 13 - Prob. 4AWCh. 13 - Prob. 5AWCh. 13 - Prob. 6AWCh. 13 - Prob. 7AWCh. 13 - Prob. 8AWCh. 13 - Prob. 9AWCh. 13 - Prob. 10AWCh. 13 - Prob. 11AWCh. 13 - Prob. 12AWCh. 13 - Prob. 1SACh. 13 - Prob. 2SACh. 13 - Prob. 3SACh. 13 - Prob. 4SACh. 13 - Prob. 5SACh. 13 - Prob. 6SACh. 13 - Prob. 7SACh. 13 - Prob. 8SACh. 13 - Prob. 9SACh. 13 - Prob. 10SACh. 13 - Prob. 11SACh. 13 - Prob. 12SACh. 13 - 1. Scrollable Tax Calculator Create an application...Ch. 13 - Skateboard Designer The Skate Shop sells the...Ch. 13 - 2. Image Viewer Write an application that allows...Ch. 13 - Prob. 3PC
Knowledge Booster
Background pattern image
Computer Science
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Text book image
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Text book image
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Text book image
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
Text book image
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Text book image
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Text book image
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Graphical User Interfaces: Crash Course Computer Science #26; Author: CrashCourse;https://www.youtube.com/watch?v=XIGSJshYb90;License: Standard YouTube License, CC-BY
Python GUI | How To Make A GUI In Python | Best GUI Framework In Python | Edureka; Author: edureka!;https://www.youtube.com/watch?v=_PHJvjQJa3w;License: Standard Youtube License