Java Swing AWT Question:

What is the purpose of action interface in Swing?

Tweet Share WhatsApp

Answer:

Action is performed on a state to allow it to change. It defines the interface that it is implementing. The library that is used for the action interface is javax.swing.Action. This action interface extends the ActionListener interface class that is being provided from the AWT. Action interface allow the concrete classes to implement the actionPerformed() method and provide the action that is associated with it. The use of actionPerformed() method allow the implementation of the behavior that is desired in the programming and allow it to show the functionality of the action class. The action can be added to the container class that accepts the parameters on an event like JMenu, JPopupMenu, or JtoolBar. The container used in this automatically registers the action that is taken on the event and it acts as an ActionListener of the user interface.

Download Swing AWT PDF Read All 29 Swing AWT Questions
Previous QuestionNext Question
Explain the use of JFC in Java Swing?What is the function of Abstract Action class?