Question 5 Method Jlist Returns 1 Item List Selected Getselectedindex Getselectedvalue Get Q23361431

Question 5

Which method of a JList returns -1 if no item in the list isselected?

getSelectedIndex
getSelectedValue
getIndex
getValue

Question 6

The method used to add panels to a JTabbedPane is

newTab.
newPanel.
addPanel.
addTab.

Question 7

An icon can be specified for a tab using the _____ method.

addTab
setIcon
setImage
tabIcon

Question 8

Suppose ArrayList cities contain the two strings {“Chicago”,“Miami”}. Which of the following methods will cause the list tobecome {“Chicago”, “Houston”,“Miami”}?

cities.add(“Houston”)
cities.add(0, “Houston”)
cities.add(1, “Houston”)
cities.add(2, “Houston”)
0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *