Differences between action and actionListener

前端 未结 4 1192
走了就别回头了
走了就别回头了 2020-11-21 04:12

What is the difference between action and actionListener, and when should I use action versus actionListener?

4条回答
  •  一向
    一向 (楼主)
    2020-11-21 05:03

    ActionListener gets fired first, with an option to modify the response, before Action gets called and determines the location of the next page.

    If you have multiple buttons on the same page which should go to the same place but do slightly different things, you can use the same Action for each button, but use a different ActionListener to handle slightly different functionality.

    Here is a link that describes the relationship:

    http://www.java-samples.com/showtutorial.php?tutorialid=605

提交回复
热议问题