Question
Answered step-by-step

Consider the following Java program. Which object registers event listeners?import java.awt.event.*;

import javax.swing.*;

public class Clicker extends JFrame implements ActionListener {

   int count;

   JButton button;

   Clicker() {

       super("Click Me");

       button = new JButton(String.valueOf(count));

       add(button);

       button.addActionListener(this);

       setSize(200,100);

       setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

       setVisible(true);

   }

   public void actionPerformed(ActionEvent e) {

       count++;

       button.setText(String.valueOf(count));

   }

   public static void main(String[] args) { new Clicker(); }

}

Select one:

a. args

b. button

c. count

d. super

e. this

Answer & Explanation
Verified Solved by verified expert
Rated Helpful

, consectetur ad

usce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque dapibus efficitur laoreet. Nam risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel

Unlock full access to Course Hero

Explore over 16 million step-by-step answers from our library

Subscribe to view answer
Step-by-step explanation

usce dui lectus,o. Donec aliq

, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellentesque

ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec fa
Student review
100% (1 rating)