Content Frame
Note for screen reader users: There is text between the form elements on this page. To be sure that you do not miss any text, use item by item navigation methods, rather than tabbing from form element to form element.
Skip Breadcrumb Navigation
Home  arrow Student Resources  arrow Chapter Quizzes  arrow Chapter 19

Chapter 19

Swing II

This activity contains 15 questions.

Question 1.
If you do not explicitly use setDefaultCloseOperation to change the default policy to DO_NOTHING_ON_CLOSE:


Open Hint for Question 1 in a new window.
 
End of Question 1


Question 2.
If you omit a call to super.paint(g);:


Open Hint for Question 2 in a new window.
 
End of Question 2


Question 3.
Java's color system provides 8 bits for the specification red, green, blue components. This means that the number of different colors available to Java is


Open Hint for Question 3 in a new window.
 
End of Question 3


Question 4.
The paintComponent method:


Open Hint for Question 4 in a new window.
 
End of Question 4


Question 5.
The repaint method:


Open Hint for Question 5 in a new window.
 
End of Question 5


Question 6.
The validate method:


Open Hint for Question 6 in a new window.
 
End of Question 6


Question 7.

The advantages/disadvantages of extending the WindowAdapter class is (are):
  1. There is less to type; fewer chances for syntax errors
  2. It is easier just to override the few necessary methods
  3. A typo in the name of one of the WindowListener methods will go undetected
  4. This approach yields shorter code

Open Hint for Question 7 in a new window.
 
End of Question 7


Question 8.

The reason(s) that you might redefine the paint method is (are):
  1. You want every component to display correctly
  2. You want to utilize drawing (painting) methods such as drawString or fillRect
  3. You want to change the appearance of a component
  4. You never should redefine the paint method - doing so will cause the Java drawing system to fail

Open Hint for Question 8 in a new window.
 
End of Question 8


Question 9.
When specifying (creating) a new Font in Java, you specify:
  1. The name of the font
  2. The attributes of the font (e.g., bold)
  3. The color of the font (e.g., black)
  4. The size of the font, in pixels


Open Hint for Question 9 in a new window.
 
End of Question 9


Question 10.

Which statement(s) is (are) true about Java arcs?
  1. The rectangle that is used in conjunction with drawArc fits within the arc
  2. The rectangle that is used in conjunction with drawArc surrounds the arc
  3. The rectangle that is used in conjunction with drawArc is sometimes call a "bounding box"
  4. The center of the rectangle that is used in conjunction with drawArc is the same as the point that is the "center" of the arc

Open Hint for Question 10 in a new window.
 
End of Question 10


Question 11.

Which statement(s) is (are) true about the dispose method?
  1. dispose is a JFrame method
  2. dispose will terminate the JFrame and release any resources used by the JFrame
  3. dispose will terminate the enclosing JFrame, JApplet, etc., even if there are other active or open windows
  4. dispose will terminate the enclosing program as well if there are no other active, open windows

Open Hint for Question 11 in a new window.
 
End of Question 11


Question 12.

Which statement(s) is (are) true about the setVisible method?
  1. setVisible may be used on any component
  2. setVisible may be used on icons and labels, but not on buttons or frames
  3. setVisible may be used on icons, labels, buttons, but not on menu items
  4. setVisible causes not only the component in question to become (in-)visible, but the enclosing component(s) as well

Open Hint for Question 12 in a new window.
 
End of Question 12


Question 13.

Which statement(s) is (are) true of the setIcon method?
  1. can be used to insert an icon into a JLabel
  2. can be used to insert an icon into a JButton
  3. can be used to insert an icon into a JMenuItem
  4. can be used to insert an icon into a JFrame
  5. can be used to insert an icon into a JApplet

Open Hint for Question 13 in a new window.
 
End of Question 13


Question 14.

Which statement(s) is (are) true?
  1. setText and setIcon can be used to set the text and icon associated with a JButton, JLabel, or JMenuItem
  2. These methods only may be invoked once, when the associated component first is created
  3. These methods are redundant in the sense that by use of an appropriate constructor they need not be used at all
  4. The order in which these methods are invoked is irrelevant - either may be invoked before the other with the same visual effect

Open Hint for Question 14 in a new window.
 
End of Question 14


Question 15.
Which statement(s) is (are) true?
  1. You may add scroll bars to a text field
  2. You may add scroll bars to a text area
  3. Scroll bars will appear automatically, whenever they are needed
  4. You can force scroll bars to be visible all the time, if you wish


Open Hint for Question 15 in a new window.
 
End of Question 15





Pearson Copyright © 1995 - 2010 Pearson Education . All rights reserved. Pearson Addison Wesley is an imprint of Pearson .
Legal Notice | Privacy Policy | Permissions

Return to the Top of this Page