Exercises
22.4 (Fill-in-the-Blanks) Fill in the blanks in each of the following statements:
a) A JMenuItem
that is a JMenu
is called a(n) _________.
b) Method _________ attaches a JMenuBar
to a JFrame
.
c) Container class _________ has a default BoxLayout
.
d) A(n) _________ manages a set of child windows declared with class JInternalFrame
.
22.5 (True or False) State whether each of the following is true or false. If false, explain why.
a) Menus require a JMenuBar
object so they can be attached to a JFrame
.
b) BoxLayout
is the default layout manager for a JFrame
.
c) JApplet
s can contain menus.
22.6 (Find the Code Errors) Find the error(s) in each of the following. Explain how to correct the error(s).
a) x.add(new JMenuItem("Submenu Color")); ...
Get Java™ How To Program (Early Objects), Tenth 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.