CH 2
CH 2
Page - 1 -
Objective Question Bank: Advanced Java Programming (22517)
Chapter 02 The Tour of Swing
9. How will you assign the string and icon both to the JButton?
a) It is not possible
b) Use the setTextIcon( ) method
c) Use the setIconText( ) method
d) Intialize them directly in the constructor
Page - 2 -
Objective Question Bank: Advanced Java Programming (22517)
Chapter 02 The Tour of Swing
18. Which method is used to define the tabs in the tabbed pane?
a) add( )
b) addItem( )
c) addPane( )
d) addTab( )
19. The scroll bar constants for scroll pane are defined in –
a) Scrollbar class
b) ScrollPane class
c) ScrollPaneConstants class
d) Component class
Page - 3 -
Objective Question Bank: Advanced Java Programming (22517)
Chapter 02 The Tour of Swing
23. Which items we can‟t directly add to JTree using its constructor?
a) Array of objects
b) Vector
c) Hash table
d) Arrays
25. Which method is used to translate a mouse click on a specific point of the
tree to a tree path?
a) translatePoint( )
b) getLocation( )
c) getPathForLocation( )
d) getPath( )
Page - 4 -
Objective Question Bank: Advanced Java Programming (22517)
Chapter 02 The Tour of Swing
30. Which two parameters are required for JTree constructor to create a tree?
a) Data array and Row Headings
b) Data array and Column Headings
c) Single data element and Column heading
d) Single data element and Row heading
Page - 5 -
Objective Question Bank: Advanced Java Programming (22517)