How does a Swing code turn into a real graphical application
graphics, java, swing
Solution
In Swing, all the GUI components are written entirely in Java and are rendered using Java. For example, JButtons would be drawn by Java and not by any internal OS stuff. Thus, Swing components are called "light-weight components" because they are managed and rendered by Java instead of by the OS (or any native widget toolkit).
Note that Java also has a toolkit called AWT. Swing is based on nested and inherited methods from AWT, except that it creates native widgets using the OS.
So at some point, Swing will have to create a window on the screen and draw on it. The magic that actually creates the window is handled by AWT. Notice that `JFrame` extends from `java.awt.Frame` which means that although JFrame may be rendered mostly by Java, it is backed by a heavy-weight native OS window.
Problem
This question might not seem very technical but, out of curiosity,I want to know that: How does bare/raw Swing code written by me, turn into a wonderful graphical application? For example: Like when we make a JFrame visible, or when we place a JButton on it. Who makes it happen? OS or Java or JVM. Who makes the colors come up? What is the process going on behind the scenes? I ask this maybe because its the first time in my life that I made a RealWorld graphical application and these questions popped up in my mind! Thanks in advance!