简体   繁体   中英

Whats under Java event driven programing?

I have very simple, yet hard question. How is Java event driver programming implemented?

I mean, JVM first gets message from OS, and than is must call some method implemented possibly by correct GUI component (for example JFrame, i guess). But is this catchable for programmer?

I don´t know how to explain what I thing better than some example: You have a window and a button. User clicks that button. Now, JVM gets from OS that there were some mouse click and its coordinates. Now, JVM need to call some method that handles the rest inside your code. So there must be a point where JVM (the natively written SW) calls apropriate bytecode part of your (my) Java application. Than it calls apropriate action listener, but now its from your code, I believe.

So, in my example, does Java Bytecode have some table of methods invokeable directly by JVM? Becouse I believe if JVM was searching for correct method names it could take forever.

In Java, its hard for me to understand this transition between JVm and actuall code. I came from ASM, than C languages, and I would love to know how it works inside Java. Becouse I know how it works on real HW. I hope you understood me. Thanks.

您应该阅读一些有关JVM内部的文章: http//www.artima.com/insidejvm/ed2/index.html

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM