Exercises

22.4Fill in the blanks in each of the following statements:
  1. A JMenuItem that is a JMenu is called a(n)________

  2. Method_________attaches a JMenuBar to a JFrame.

  3. Container class_________has a default BoxLayout.

  4. A(n)_________manages a set of child windows declared with class JInternalFrame.

22.5State whether each of the following is true or false. If false, explain why.
  1. Menus require a JMenuBar object so they can be attached to a JFrame.

  2. BoxLayout is the default layout manager for a JFrame.

  3. Method setEditable is a JTextComponent method.

  4. Class JFrame directly extends class Container.

  5. JApplets can contain menus.

22.6Find the error(s) in each of the following. Explain how to correct the error(s).
  1. x.add( new JMenuItem( "Submenu Color" ) ); // create ...

Get Java™ How to Program, Seventh Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.