Filters
Question type

Study Flashcards

If addressList is a JList component, what will the value of x be after the following statement is executed? X = addressList.getSelectedIndex() ;


A) The value of the first selected item
B) The index of the first selected item
C) An array of objects containing the items selected
D) An array containing the indices of all the selected items in the list

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

If a user enters a value in the text box of an editable combo box and the value is NOT in the list, what will the method getSelectedIndex return?


A) The index of the item that the user replaced
B) The index of the item the user entered
C) -1
D) 0, since the item is not in the list

E) A) and C)
F) B) and D)

Correct Answer

verifed

verified

If a user enters a value in the text box of an editable combo box and the value is NOT in the list, what will the method getSelectedItem return?


A) The value that the user replaced
B) The index of the item the user entered
C) The value that appears in the text field, even if it is not in the combo box's list
D) Nothing, since the item is not in the list

E) All of the above
F) A) and D)

Correct Answer

verifed

verified

When you write a change listener class method for a slider, it must implement the ChangeListener interface which is in the javax.swing.event package.

A) True
B) False

Correct Answer

verifed

verified

The ImageIcon class supports all the following file types, EXCEPT:


A) BMP
B) JPEG
C) GIF
D) PNG

E) None of the above
F) All of the above

Correct Answer

verifed

verified

What will be the results of executing the following statements? X.setEditable(true) ; X.setText("Tiny Tim") ;


A) The text field x will have the value "Tiny Tim" and be read-only.
B) The text field x will have the value "Tiny Tim" and the user will be able to change its value.
C) The text field x will have the value true.
D) The text field x have the value "trueTiny Tim"

E) None of the above
F) C) and D)

Correct Answer

verifed

verified

What will display when the following code is executed? ImagePanel = new JPanel() ; ImageLabel = new JLabel() ; ImagePanel.Add(imageLabel) ; ImageIcon sunnyFaceImage = New ImageIcon("SunnyFace.gif") ; ImageLabel.setIcon(sunnyFaceImage) ; Pack() ;


A) The JFrame that encloses the window will resize itself to accommodate the SunnyFace image.
B) imagePanel will resize itself to accommodate the SunnyFace image.
C) The SunnyFace image will resize itself to fit on imageLabel.
D) The SunnyFace image will resize itself to fit on imagePanel.

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

A tool tip is:


A) a guide provided by the Help menu as to which tool to use for various programming techniques
B) another name for the Tool Bar
C) used to make programming easier
D) text that is displayed in a small box when the user holds the mouse cursor over a component

E) A) and B)
F) None of the above

Correct Answer

verifed

verified

When you create an instance of the JList class:


A) you pass an array of objects to the constructor
B) the list has a default selection mode of Single Selection Mode
C) the values in the list are automatically sorted
D) you must indicate the maximum number of list items the user may select at any one time

E) None of the above
F) B) and D)

Correct Answer

verifed

verified

What will display when the following code is executed: JLabel label = new JLabel ("It is a beautiful morning.") ; Labed.setIcon(SunnyFace.gif) ;


A) A label with the text "It is a beautiful day." to the left of the SunnyFace image
B) A label with the text "It is a beautiful day." to the right of the SunnyFace image
C) A label with the text "It is a beautiful day." below the SunnyFace image
D) A label with the text "It is a beautiful day." above the SunnyFace image

E) B) and C)
F) A) and B)

Correct Answer

verifed

verified

What does the following statement do? JTextArea textField = JTextArea(message, 25, 15) ;


A) It creates a text area with 25 columns and 15 rows that will initially display the text stored in the String object message.
B) It creates a text area with 25 columns and 15 rows that will initially display the text stored in the text area textField.
C) It creates a text area with 25 rows and 15 columns that will initially display the text stored in the String object message.
D) It creates a text area with 25 rows and 15 columns that will initially display the text "message".

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

A read-only text field uses the JReadOnlyTextField component.

A) True
B) False

Correct Answer

verifed

verified

When an item in a Jlist object is selected it generates a(n) :


A) action listener event
B) action performed event
C) list selection listener event
D) list selection event

E) C) and D)
F) All of the above

Correct Answer

verifed

verified

What will the following code do when it is executed? JTextArea message = JTextArea(greetings, 50, 70) ; JScrollPane scrollPane = new JScrollPane(message) ;


A) It will create a JScrollPane object for the JTextArea object referenced by message and display a horizontal scroll bar on the text area.
B) It will create a JScrollPane object for the JTextArea object referenced by message and display a vertical scroll bar on the text area.
C) It will create a JScrollPane object for the JTextArea object referenced by message and display both vertical and horizontal scroll bars on the text area.
D) It will create a JScrollPane object for the JTextArea object referenced by message and display no scroll bars on the text area.

E) B) and D)
F) None of the above

Correct Answer

verifed

verified

The following statement: textList.setSelectionMode( ListSelectModel.SINGLE_INTERVAL_SELECTION) ;


A) sets the textList component to single selection mode
B) sets the textList component to ListSelectModel
C) sets the textList component to single interval selection mode
D) sets the value of textList to SINGLE_INTERVAL_SELECTION

E) A) and B)
F) A) and C)

Correct Answer

verifed

verified

A ________ object specifies a component's width and height.


A) Container
B) Region
C) Frame
D) Dimension

E) All of the above
F) B) and C)

Correct Answer

verifed

verified

This is a specialized dialog box that allows the user to select a color from a predefined palette of colors.


A) Hue picker
B) Color chooser
C) Paint dialog box
D) Palette selector

E) A) and D)
F) A) and C)

Correct Answer

verifed

verified

A menu system may consist of each of the following, EXCEPT:


A) check box menu item
B) combo box menu item
C) radio button menu item
D) menu item

E) None of the above
F) A) and B)

Correct Answer

verifed

verified

A menu system may consist of each of the following EXCEPT:


A) menu item
B) separator bar
C) menu bar
D) It may have all the above.

E) None of the above
F) C) and D)

Correct Answer

verifed

verified

To force the JFrame that encloses a window to resize itself automatically when a larger object is placed in the frame, use:


A) the pack method
B) the resize method
C) the grow method
D) the enlarge method

E) A) and D)
F) C) and D)

Correct Answer

verifed

verified

Showing 21 - 40 of 58

Related Exams

Show Answer