While java programs are platform independent, the JVM itself is platform dependent. I am interested in knowing how Java draws the application GUI (buttons and text) on the screen.
Under Windows, control objects such as buttons are usually created using a window(from user32.dll) or a rectangular region(from gdi32.dll), text is drawn later to the corresponding window/region handle using the provided user32/gdi32 text draw functions.
I tried running a simple two button Java gui application using swing and hooking the majority of create region/window and text draw functions from gdi32.dll and user32.dll, but so far, it seems the Java program is just using these native dlls for drawing the main window frame only.
Does Java.exe uses some other dlls to draw buttons and other controls on the screen ? And if so, why is this case when there are already available native dlls for drawing ?
java.exe
doesn’t draw anything; it’s just a launcher for the JVM, which also doesn’t draw anything, but provides an infrastructure for executing Java code, which may use native libraries, so you have to address the particular code and libraries for your question. Since Swing uses pluggable look & feels, there isn’t a single answer for Swing—it depends on the Look&Feel… – Holger