Podcast
Questions and Answers
What method in the MouseEvent class returns the number of mouse clicks associated with the event?
What method in the MouseEvent class returns the number of mouse clicks associated with the event?
- int getX()
- int getButton()
- int getY()
- int getClickCount (correct)
Which MouseEvent event method provides the x-position of the event relative to the source component?
Which MouseEvent event method provides the x-position of the event relative to the source component?
- MOUSE_ENTERED
- MOUSE_DRAGGED
- getX() (correct)
- MOUSE_CLICKED
In the JList Class, what is used to construct a JList object?
In the JList Class, what is used to construct a JList object?
- A character
- An integer
- A boolean
- An array of Strings (correct)
Which MouseEvent method returns which, if any, of the mouse buttons has changed state?
Which MouseEvent method returns which, if any, of the mouse buttons has changed state?
What type of event serves as an indication that the mouse pointer has exited a component?
What type of event serves as an indication that the mouse pointer has exited a component?
Which method would you use to find the largest selected cell index in a JList?
Which method would you use to find the largest selected cell index in a JList?
When would you use the method setSelectedIndex(int index) in a JList?
When would you use the method setSelectedIndex(int index) in a JList?
Which type of JScrollPane constructor would you need if you want to create a JScrollPane with both horizontal and vertical scroll bars that appear when needed, but start empty?
Which type of JScrollPane constructor would you need if you want to create a JScrollPane with both horizontal and vertical scroll bars that appear when needed, but start empty?
What does the method isSelectionEmpty() return when nothing is selected in a JList?
What does the method isSelectionEmpty() return when nothing is selected in a JList?
Which JList method would you use to determine whether single-item or multiple-item selections are allowed?
Which JList method would you use to determine whether single-item or multiple-item selections are allowed?
In a JList, what does the method getFirstVisibleIndex() return?
In a JList, what does the method getFirstVisibleIndex() return?
Which method is not invoked when the mouse button has been clicked on a component?
Which method is not invoked when the mouse button has been clicked on a component?
Which method is invoked when the mouse cursor has been moved onto a component but no buttons have been pressed?
Which method is invoked when the mouse cursor has been moved onto a component but no buttons have been pressed?
Which static int of MouseEvent class indicates no mouse buttons?
Which static int of MouseEvent class indicates no mouse buttons?
Which interface includes all the methods in both the MouseListener and MouseMotionListener interfaces?
Which interface includes all the methods in both the MouseListener and MouseMotionListener interfaces?
Which method is invoked when the mouse button is pressed on a component and then dragged?
Which method is invoked when the mouse button is pressed on a component and then dragged?
Which method is not invoked when the mouse button is released on a component?
Which method is not invoked when the mouse button is released on a component?
What is a requirement for the class of an object that responds to an event?
What is a requirement for the class of an object that responds to an event?
What does the getModifiers() method of the MouseEvent class return?
What does the getModifiers() method of the MouseEvent class return?
Which interface provides methods named mouseDragged() and mouseMoved()?
Which interface provides methods named mouseDragged() and mouseMoved()?
What is the purpose of the getSource() method of the EventObject class?
What is the purpose of the getSource() method of the EventObject class?
What does the getStateChange() method of the ItemEvent class return?
What does the getStateChange() method of the ItemEvent class return?
Which listener interface has methods named focusGained() and focusLost()?
Which listener interface has methods named focusGained() and focusLost()?
Which event type is generated when a button in a Swing GUI is clicked?
Which event type is generated when a button in a Swing GUI is clicked?
What is the parent class of all event objects in Java?
What is the parent class of all event objects in Java?
Which event listener is used to handle events generated from scroll bar movements?
Which event listener is used to handle events generated from scroll bar movements?
What method gets executed in response to the generated events in an event listener object?
What method gets executed in response to the generated events in an event listener object?
Which event type is generated when text is entered into a text field in a Swing GUI?
Which event type is generated when text is entered into a text field in a Swing GUI?
Which event listener is used to handle events generated from text field gaining or losing focus?
Which event listener is used to handle events generated from text field gaining or losing focus?