What's the theory of action listener in java? -


i mean how implement real time action, multi threads or what?

look, if add action listener jbutton, , put following codes in main function,

while(true){    system.out.print("a"); } 

and print b 100 times in action listener of jbutton. after clicking button, expected see 100 constant b printed, , after there string of a. result turns out expected wrong.

so want ask, exact relationship between action listener , main function? 2 threads or something?

i looking forward answer, thanks!

basically action listener , main function not related directly, create jbutton , add action listener, perform whatever function want perform. main fuction not involved in unless so. everytime create button thread created , runs independently.


Comments

Popular posts from this blog

java - Plugin org.apache.maven.plugins:maven-install-plugin:2.4 or one of its dependencies could not be resolved -

Round ImageView Android -

How can I utilize Yahoo Weather API in android -