Is there a better practice for Listeners?

前端 未结 5 2025
深忆病人
深忆病人 2020-12-10 22:49

Say I have a swing GUI, and I want to listen MouseEvents. Who do you think should be the Listener class, who should be responsible? What is the best-or preferr

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-10 23:52

    anonymous classes are mainly used for listeners. If you know that you'll have a particular listener registered just once and it's rather short, then you can use anonymous class.

提交回复
热议问题