P4 Test Questions

(Project Test Home Page)

# Question
1 JOptionPane
Which of the following statements is true?
(Choose all that apply)

A. JOptionPane is in the java.awt package.
B. JOptionPane was introduced in JDK1.2 with the Swing technology.
C. All Dialogs created with JOptionPane are modal.
D. None of the above.

2 JOptionPane.showMessageDialog()
Which of the following statements is true about the following sample code?
(Choose all that apply)

JOptionPane.showMessageDialog( null, "Are you happy?", "Smile", JOptionPane.QUESTION_MESSAGE );

A. A non-modal dialog box will appear with the words "Are you happy?" in middle of the box.
B. A modal Dialog box will appear with the words "Are you happy?" in the middle of the box.
C. The Dialog box will have an Icon of a "?" on the left side.
D. null is passed as the first parameter so that a default Frame is used as the parent.

3 JOptionPane.showInputDialog()
Assuming that JOptionPane is not an object, which of the following statements are true about the following sample code?
(Choose all that apply)

strMsg = JOptionPane.showInputDialog(null, "Enter you address", "Client Info", JOptionPane.INFORMATION_MESSAGE);

A. This code will not compile because a JOptionPane object has not been created.
B. An Icon with the letter "i" will appear in the left corner of the dialog box.
C. The Input Dialog box will be non-modal.
D. strMsg will contain a String of whatever the user types in the input dialog box.

4 A modal dialog box will suspend program execution until the user completes the dialog box. Components in Frames are non-modal allowing the user to choose which components they want to access. Given this correct information, which of the following statements is true concerning the terms modal & non-modal?
(Choose all that apply)

A. Java has no modal components.
B. Components like textfield and buttons non-modal.
C. All JOptionPane dialog boxes are modal.
D. None of the above.