Is action listener a thread, and if it is, what is the affect of this thread on my own-defined threads??
especially in Swing/AWT when you define your own thread, or when you use a thread to make an animation, is actionlistener affect that? and why?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
No, an action listener is an interface. You can implement that interface by defining what its
actionPerformed()method does (assuming you refer to this ActionListener). That method is going to run in the thread that calls it.So if you call it from one of your threads, it will run in that thread. If
actionPerformedinteracts with UI components, it is probably a bad idea to do that.You can read more about ActionListeners in Swing and Concurrency & Swing.