简体   繁体   English

Java AWT本机OS库?

[英]java AWT native OS library?

As we know AWT classes uses native OS libraries for creating GUIs but Swing uses Java library itself for creating the GUI.Can anyone please give me an example of the Windows OS library corresponds to a AWT GUI ? 众所周知,AWT类使用本机OS库来创建GUI,而Swing使用Java库本身来创建GUI。有人可以给我一个与AWT GUI对应的Windows OS库示例吗?

Thx 谢谢

In theory it may depend on jvm implementation. 从理论上讲,它可能取决于jvm的实现。 But in windows it use WinAPI probably. 但是在Windows中,它可能使用WinAPI。

If you need to know the really small details of how it's implemented in a low-level, download the jdk source (OpenJDK is FLOSS), and read the code yourself. 如果您需要了解如何在底层实现的非常小的细节,请下载jdk源代码(OpenJDK是FLOSS),然后自己阅读代码。
Don't expect anyone except developers who were directly related to that code to know the exact answer to your question. 除了与该代码直接相关的开发人员之外,不要期望其他人知道您问题的确切答案。

The short answer is the MFC (Microsoft Foundation Classes) which all of Windows widgets are based on. 简短的答案是所有Windows小部件都基于的MFC(Microsoft基础类)。

If you recall the great MS and Java Lawsuit the reason MS "Split" with how Java was developing was the MFC--at that point, Sun was considering a "JFC" which more or less later became Swing. 如果您还记得MS和Java诉讼案,那是与Java开发方式有关的MS“ Split”是MFC的原因–那时,Sun正在考虑一个“ JFC”,后来或多或少成为了Swing。 they didn't want to re-invent something they already have. 他们不想重新发明他们已经拥有的东西。 regardless, Swing is based on AWT which is heavily based on Motif/X which if I remember right is also what MS based their MFC on... It not the jvm that determines how a particular Java Swing/AWT element--like a button, but the Native Peer for that platform, which is bound to Java via the JNI.... 不管怎么说,Swing是基于AWT的,而AWT很大程度上是基于Motif / X的,如果我没记错的话,MS也是基于它们的MFC的...不是由jvm决定特定Java Swing / AWT元素的方式-就像按钮一样,但该平台的Native Peer,通过JNI绑定到Java。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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