Multiple Choice
Consider the following code snippet:
Final RectangleComponent component = new RectangleComponent() ;
MouseListener listener = new MousePressListener() ;
Component.addMouseListener(listener) ;
______________
Mystery.add(component) ;
Mystery.setSize(FRAME_WIDTH, FRAME_HEIGHT) ;
Mystery.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE) ;
Mystery.setVisible(true) ;
Which of the following statements completes this code?
A) JPanel mystery = new JPanel() ;
B) JComponent mystery = new JComponent() ;
C) Frame mystery = new Frame() ;
D) JFrame mystery = new JFrame() ;
Correct Answer:

Verified
Correct Answer:
Verified
Q5: Suppose a JPanel with a BorderLayout manager
Q8: When adding a component to a container
Q11: What can be determined about obj from
Q31: Which component can be added to a
Q32: Which elements of creating a graphical user
Q62: If one ChangeListener is listening for three
Q71: Which GUI element allows text entry from
Q75: What is wrong with the following code?<br>Class
Q76: If the method makeMenuItem is called four
Q79: A(n) _ is used to capture mouse