Question

When a client programmer implements ActionListener in his or her class, the method actionPerformed needs to...

When a client programmer implements ActionListener in his or her class, the method actionPerformed needs to be implemented by the client programmer.  Why does Java offers this type of design for the ActionListener class?

0 0
Add a comment Improve this question Transcribed image text
Answer #1
When a client programmer implements ActionListener in his or her class, the method actionPerformed needs to be implemented by the client programmer.
Why does Java offers this type of design for the ActionListener class?

This is called a callback mechanism.
In java we can attach ActionListener objects to UI actions.
when an UI action is performed, we want java make a callback to the attached object, by calling its actionPerformed method.
Add a comment
Know the answer?
Add Answer to:
When a client programmer implements ActionListener in his or her class, the method actionPerformed needs to...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Design MountainBike and RoadBike class for a simulation game Mike is a programmer working in his ...

    Design MountainBike and RoadBike class for a simulation game Mike is a programmer working in his afterhours to design games for mobile platforms. His recent project is a simulation game in which a player controls a bike to move across a variety of simulated environments. To start coding, Mike has to design a collection of bikes including a mountain bike and a road bike, so that the player can choose the preferred bike. He is now implementing two classes, MountainBike...

  • Design MountainBike and RoadBike class for a simulation game Mike is a programmer working in his...

    Design MountainBike and RoadBike class for a simulation game Mike is a programmer working in his afterhours to design games for mobile platforms. His recent project is a simulation game in which a player controls a bike to move across a variety of simulated environments. To start coding, Mike has to design a collection of bikes including a mountain bike and a road bike, so that the player can choose the preferred bike. He is now implementing two classes, MountainBike...

  • How can i make the java class seperate into an MVC pattern? public class ChatView implements Acti...

    How can i make the java class seperate into an MVC pattern? public class ChatView implements ActionListener {    public static void main(String[] args)    {        JFrame chatFrame = new JFrame();        JFrame chatFrame1 = new JFrame();        JFrame chatFrame2 = new JFrame();               JPanel chatPanel = new JPanel();        JPanel chatPanel1 = new JPanel();        JPanel chatPanel2 = new JPanel();        chatFrame.setContentPane(chatPanel);        chatFrame1.setContentPane(chatPanel1);        chatFrame2.setContentPane(chatPanel2);        chatFrame.setLayout(new FlowLayout());        chatFrame1.setLayout(new FlowLayout());        chatFrame2.setLayout(new FlowLayout());        JTextField chatWrite = new JTextField();        JTextField chatWrite1 = new JTextField();        JTextField chatWrite2 = new JTextField();        JTextArea chatDisplay...

  • 1.     When a sub class object is created, when is the call to the super class...

    1.     When a sub class object is created, when is the call to the super class constructor made? How does a programmer call the super class constructor from the sub class? What do all classes indirectly extend? What methods does every class inherit from the Object class? 2.     When writing methods in a sub class, how can those methods call the methods from the parent class? 3.     Which class is more specific, a super class or a sub class? 4.    ...

  • When a manager is aware of the needs of his or her employees and has the...

    When a manager is aware of the needs of his or her employees and has the ability to influence them to work toward the organization's goals, the manager is exhibiting Multiple Choice conceptual thinking.      leadership.    networking.      technical skills.    analytical skills. Jayla just opened a fitness studio in her hometown. Since her goal is to become the leading fitness studio in the area, she approaches five of the most talented trainers at competitive gyms and offers them more money to...

  • Java: Write a class ArrayIntersection that implements the method below. public static int[] get(int[] one, int[]...

    Java: Write a class ArrayIntersection that implements the method below. public static int[] get(int[] one, int[] two) Given two arrays, it returns a new array with all values that are in both arrays. The returned array has a size fitting its elements exactly and without duplicates. The order of values does not matter. For example, given {1,5,5,1} and {5,3}, the method returns {5}.

  • Java language (a) Create a class HexEditor with a constructor which creates a 5x10 text area...

    Java language (a) Create a class HexEditor with a constructor which creates a 5x10 text area in a Frame. Also add a pull-down menu with a menu item "Load". Copy the class as the answer to this part. (b) Create another class TestHexEditor with a main() method which creates an object anEditor of the class HexEditor and displays the frame in part (a) using setVisible(true). Copy the class as the answer to this part. (c) Make changes to the class...

  • Question 1 Samantha is working through the Client Needs Assessment process. Which 4 areas should she...

    Question 1 Samantha is working through the Client Needs Assessment process. Which 4 areas should she focus on to gather information for her client? (Select all that apply) Who is the client Why did the client start their business What services does the client need How will the client work be completed  Which team member will do the work When does the client need their work completed

  • In Java Pls Class Design: Donut (Suggested Time Spent: < 15 minutes) The Donut class is intended to be an abstract a...

    In Java Pls Class Design: Donut (Suggested Time Spent: < 15 minutes) The Donut class is intended to be an abstract and simplified representation of a yummy edible donut Class Properties (MUST be private) Name of the donut Type of donut Price of the donut Class Invariants Donut name must not be empty (Default: "Classic") Type of donut can only be one of the following: "Plain," "Filled," or "Glazed" (Default: "Plain") Class Components Public Getter and Private Setter for name,...

  • Please help me on all the questions !!!!!!!! Really need help! Will give a thumb up...

    Please help me on all the questions !!!!!!!! Really need help! Will give a thumb up for helping. True/False (11) Chapter 12 - Lists The ADT list only works for entries that are strings. The ADT list is more general than common lists and has entries that are objects of the same type. Adding entries to the end of a list does not change the positions of entries already in the list. The first entry is a list is at...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT