Java Swing AWT Question:
Download Questions PDF

What is the function of Abstract Action class?

Swing AWT Interview Question
Swing AWT Interview Question

Answer:

AbstractAction class allows the implementation of the abstract functions and the action interfaces. AbstractAction provides with the default functionality that are provided with the methods in the Action interface. The action can extend the class to create some specific actions for the users. The methods that is provided to implement the actionPerformed() method and it is used to provide the overall functionality for the action. ActionEvent is used to show the action command that can be used to add some features of the contents and provide ready to use action functionality on the event that can be carried for all the user interface fields.

class MyAction extends AbstractAction
{ }
public MyAction(String text, Icon icon)
{ super(text,icon); }
public void actionPerformed(ActionEvent e)
{ System.out.println("Action ["+e.getActionCommand()+"]!"); }

Download Swing AWT Interview Questions And Answers PDF

Previous QuestionNext Question
What is the use of JComponent Class in Swing?What is the purpose of action interface in Swing?