How does Java make windows?

How does the JVM make its window? I know it has jar files and executable files

Is it a graphics library standard installed on the machine?

Solution

There are two types of UI components in Java: heavyweight and lightweight

Heavyweight components are wrappers of what exists in the operating system As an operating system, windows has the method of creating windows, dialog boxes, etc

Use 2D drawing API to completely create lightweight components in the application The operating system knows nothing about it

The two "official" Java GUI APIs are swing and AWT AWT is usually used by applets (early anyway) It consists of heavyweight components Swing is built on AWT, but the APIs used to design desktop applications are more extensive Most swing components are lightweight

Therefore, java desktop applications may contain one or more heavyweight components, and may contain some lightweight components Or if the 2D drawing API is enough to "fake" windows without heavyweight components, it may be all lightweight components

The framework you see around a Java application may be drawn with a library such as Java2D (directly or by using it or components similar to API), or it may be created by windows, with configuration from the application, and may be affected by the operating system, theme and display settings

Most Java applications today are lightweight

The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
分享
二维码
< <上一篇
下一篇>>