• Shuffle
    Toggle On
    Toggle Off
  • Alphabetize
    Toggle On
    Toggle Off
  • Front First
    Toggle On
    Toggle Off
  • Both Sides
    Toggle On
    Toggle Off
  • Read
    Toggle On
    Toggle Off
Reading...
Front

Card Range To Study

through

image

Play button

image

Play button

image

Progress

1/29

Click to flip

Use LEFT and RIGHT arrow keys to navigate between flashcards;

Use UP and DOWN arrow keys to flip the card;

H to show hint;

A reads text to speech;

29 Cards in this Set

  • Front
  • Back

With Swing, you use this class to create a frame.a. Frameb. SwingFramec. JFramed. JavaFrame

1. c

This is the part of a JFrame object that holds the components that have been added tothe JFrame object.a. content paneb. viewing areac. component arrayd. object collection

2. a

This is a JPanel object’s default layout manager.a. BorderLayoutb. GridLayoutc. FlowLayoutd. None

3. c

This is the default layout manager for a JFrame object’s content pane.a. BorderLayoutb. GridLayoutc. FlowLayoutd. None

4. a

If a container is governed by a BorderLayout manager and you add a component to it,but you do not pass the second argument specifying the region, this is the region inwhich the component will be added.a. northb. southc. eastd. center

5. d

Components in this/these regions of a BorderLayout manager are resized horizontallyso they fill up the entire region.a. north and southb. east and westc. center onlyd. north, south, east, and west

6. a

Components in this/these regions of a BorderLayout manager are resized vertically sothey fill up the entire region.a. north and southb. east and westc. center onlyd. north, south, east, and west

7. b

Components in this/these regions of a BorderLayout manager are resized both horizontallyand vertically so they fill up the entire region.a. north and southb. east and westc. center onlyd. north, south, east, and west

8. c

This is the default alignment of a FlowLayout manager. a. left b. center c. right d. no alignment

9. b

Adding radio button components to this type of object creates a mutually exclusiverelationship between them.a. MutualExcludeb. RadioGroupc. LogicalGroupd. ButtonGroup

10. d

You use this class to create Border objects.a. BorderFactoryb. BorderMakerc. BorderCreatord. BorderSource

11. a

True or False: A panel cannot be displayed by itself.

12. True

True or False: You can place multiple components inside a GridLayout cell.

13. False

True or False: You can place multiple components inside a BorderLayout region.

14. False

True or False: You can place multiple components inside a container governed by a FlowLayout manager.

15. True

True or False: You can place a panel inside a region governed by a BorderLayout manager.

16. True

True or False: A component placed in a GridLayout manager’s cell will not be resized to fill up any extra space in the cell.

17. False

True or False: You normally add JCheckBox components to a ButtonGroup object.

18. False

True or False: A mutually exclusive relationship is automatically created among all JRadioButton components in the same container.

19. False

True or False: You can write a class that extends the JPanel class.

20. True

The following statement is in a class that uses Swing components:


import java.swing.*;

The x is missing in the package name. The statement should read:


import javax.swing.*;

The following is an inner class that will be registered as an action listener for aJButton component:


private class ButtonListener implements ActionListener{ public void actionPerformed() { // Code appears here. }

The actionPerformed method must have an ActionEvent parameter.

The intention of the following statement is to give the panel object a GridLayoutmanager with 10 columns and 5 rows:


panel.setLayout(new GridLayout(10, 5));

The arguments passed to the GridLayout constructor are reversed. This statement creates 10rows and 5 columns.

The panel variable references a JPanel governed by a BorderLayout manager. The following statement attempts to add the button component to the north region of panel: panel.add(button, NORTH);

The second argument passed to the add method should be


BorderLayout.NORTH.

The panel variable references a JPanel object. The intention of the following statementis to create a titled border around panel:panel.setBorder(new BorderFactory("Choices"));

You do not create an instance of BorderFactory. Instead you call one of its static methods to create a Border object. The statement should read: panel.setBorder(BorderFactory.createTitledBorder("Choices"));

If you do not change the default close operation, what happens when the user clickson the close button on a JFrame object?

The window is hidden from view, but the application does not end.

Why is it sometimes necessary to place a component inside a panel and then place the panel inside a container governed by a BorderLayout manager?

This prevents the component from being resized. The BorderLayout manager resizes components to fill up any extra space in a region. When you place a component inside a panel, and then place the panel in a BorderLayout region, the panel is resized instead of the component it contains.

In what type of situation would you present a group of items to the user with radio buttons? With check boxes?

Radio buttons are normally used to select one of several possible items. Because a mutually-exclusive relationship usually exists between radio buttons, only one of the items may be selected. Check boxes, which may appear alone or in groups, allow the user to make yes/no or on/off selections. Because there is not usually a mutually-exclusive relationship between check boxes, the user can select any number of them when they appear in a group.

How can you create a specialized panel component that can be used to hold other components and their related code?

By creating a class that is derived from JPanel.