Button Components  Self Test With Answers


1) Which of the following is the parent to the others

a) JCheckbox
b JToggleButton
c) JRadioButton                                             ( b )

2) The AbstractButton class does not incorporate the ability to process which
    of the following event types?

a) Item
b) Action
c) Component
d) Change                                                        ( c )

3)
a) True or False.  JToggleButton looks like a regular JButton but has the selected
    behaviour of JRadioButton. (True)
b) True or False.  JToggleButton when activated it remains depressed. (True)
 

4) Which of the following is not correct?

a) Separators can be added using the  addSeparator( ) method.
b) JMenuItems are added to JMenus using add( ) methods
c) JMenus are added to JMenuBars using add( ) methods
d) JMenuBars are added to JFrames using an addMenuBar( ) method
                                                                                    ( d )
 

5) When a JPopupMenu is invoked using MouseEvent processing
which of the following methods is called on the popup menu object?

a) getComponent( )
b) addMouseListener( )
c)  getY( )
d) show( )                                                                  ( d  )

6 ) JProgressBar doesn't use which of the following methods.
a) setMaximum( )
b) getValue( )
c) addItemListener( )
d) getModel( )                                                        ( c )

// Comment: JProgressBar generates a Change not an Item event.