Can a class be it?s own event handler? Explain how to implement this?



Can a class be it?s own event handler? Explain how to implement this?..

Answer / Manish Yadav

Yes, a class can serve as its own event handler in Swing by implementing the required interface (e.g., ActionListener or MouseListener) and overriding the appropriate method(s). By doing so, the class becomes both the event source and listener, eliminating the need for separate listener classes.

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More Swing Interview Questions

Write a program to include the internal frame in swing.

1 Answers  


What is swing control?

1 Answers  


What is a swing application?

1 Answers  


I want to change the appearance of Frame in Runtime, what class can be used to do this?

2 Answers   TCS, Wipro,


What is the purpose of serialization in swings?

1 Answers  


What is difference between jframe and swing?

1 Answers  


How to move from one page to another in java swing?

1 Answers  


Explain the below Statement if(ae.getSource()==b1)

2 Answers   IPSG Systems, TCS,


What are all the components used in Swing?

1 Answers  


Default layout for a ContentPane in JFC?

8 Answers   HCL,


What is an event handler in swing?

1 Answers  


What are the advantages of java swing over angular?

1 Answers  


Categories