“J”是什么意思? 在JApplet中是什么意思?

发布于 2024-07-15 04:30:39 字数 26 浏览 3 评论 0原文

JApplet 中的“J”是什么意思?

What does the "J" in JApplet mean?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

夏见 2024-07-22 04:30:39

当 Sun 开始开发 Swing 时,他们有像 javax.swing.Button 这样的东西。 这给使用 java.awt.Button 的程序带来了问题。 如果我没记错的话,主要问题是编译器错误消息令人困惑。

Sun 决定为所有 Swing 组件添加 J 前缀以消除此问题。

最初 Swing 被称为 JFC - Java 基础类...大概 J 就是由此而来。

Netscape 的 IFC 是 JFC 的基础...两者都是同一团队开发的。
团队从 Netscape 搬到了 Sun。
J 出现在第一次向被许可人提供来源的时候(我就是在我的公司收到该来源的人)。

JClass BWT 和 IFC(成为JFC(后来成为 Swing)也不兼容......“我可以在 IFC 环境中使用 BWT 控件吗?

编辑:回复 Swing 团队成员的电子邮件...

“未命名的名字已被占用
通过 AWT,我们认为使用它很有用
一个共同的前缀来区分
来自其他类的“组件”
包。”

已经采取的部分确实与我所说的有关编译器的内容相符,但没有证实它。

When Sun started working on Swing they had things like javax.swing.Button. This caused problems for programs that mase use of java.awt.Button. The main issue, if I remember right, was that the compiler error messages were confusing.

Sun decided to prefix all of the Swing components with J to remove this issue.

Originally swing was called JFC - Java Foundation Classes... presumably the J came from that.

IFC from Netscape was the foundation for JFC... the same team developed both.
The team moved from Netscape to Sun.
The J was there at the first source drop to licensees (I was the person why received the drop at my company).

The JClass BWT and the IFC (which became the JFC, which became Swing) were incompatible as well... "Can I use BWT controls in an IFC environment?"

Edit: Response to an email from a member of the Swing team...

"The un-J'd names were already taken
by AWT and we thought it useful to use
a common prefix to distinguish
"components" from other classes in the
package."

The already taken part does match with what I said about the compiler, but does not confirm it.

晚雾 2024-07-22 04:30:39

“J”首先由KL Group(现为 quest.com) 其革命性的 BWT 构成了当今改进的 AWT(称为 Swing /JFC)的基础。

因此,它来自当今祖先 "https://support.quest.com/jclass-desktopviews/6.5.2" rel="nofollow noreferrer">KL JClass
事实并非如此,根据TofuBeer的回答:我将其余部分保留为社区答案,因为它详细说明了 JClass 是什么,但“J”可能根本不是来自将其库集成到 Swing 中。)

JClass SwingSuite,Sun Microsystems, Inc. 的 Java(TM) 开发工具包(JDK(TM) 版本 1.2)中 Swing 的一组新扩展和增强功能:它与 Sun 的公告一致今天在纽约 Java(SM) Business Expo(SM) 期间介绍了 JDK 1.2 的可用性。

JClass JavaBeans 在许多流行的 Java IDE 中都可用,是世界各地的专业和企业开发人员使用的基本组件。
JClass 3.6 包括“J”版本,它与 javax.swing 包配合使用,支持当今使用 JDK 1.2 进行开发和部署


来自 JClass 3.6 到 4.0 移植指南KL Group 发布 JClassLine 的 Swing 更新(1998 年 3 月)

为了适应 Java 开发人员可能使用的各种类型的环境,我们开发了可用于特定 Java 开发工具包 (JDK) 的 JClass 产品版本。 以下列出了不同版本之间的差异:

  • “J”版本:使用JDK 1.1 + Swing 1.1(推荐使用JDK 1.1.8 + Swing 1.1.1)
  • “K”版本:使用Java 2(推荐JDK 1.2.2)

JClass 3.6 和之前的版本使用的字母方案略有不同,如下:

  • “T”版本:使用 JDK 1.0.2 API 并实现“过渡”JavaBean
  • “Unlettered”版本:使用 JDK 1.1.x 并包含完整的 JavaBean 实现
  • “S”版本:使用 JDK 1.1/Swing 1.0.3
  • “J”版本:使用 JDK 1.2 或 JDK 1.1 和 Swing 1.1

一些一般上下文:

来自 基本 Java Applet 和 JApplet

AWT(抽象窗口工具包)从一开始就是 Java 的一部分,但是,几乎从一开始,就很明显 AWT 不够强大或灵活,无法编写复杂、精密的应用程序。

这并不妨碍它的有用性——特别是对于小程序,它们通常不像完整的独立应用程序那么复杂。

Swing 图形用户界面库的创建是为了解决 AWT 的问题。 随着 Java 1.2 版本的发布,Swing 成为 Java 的正式组成部分。 (从 1.2 开始的 Java 版本也被称为“Java 2”,这很容易混淆。)

仍然有充分的理由基于 AWT 编写小程序,例如许多 Web 浏览器缺乏对 Java 2 的支持。但是,在这一点上,任何用 Java 编写独立图形应用程序的人几乎都应该是使用 Swing。

组成 Swing 库的类可以在包 javax.swing 中找到。 Swing 包含类 javax.swing.JApplet,用作编写 applet 的基础。

JApplet实际上是Applet的子类,因此JApplets实际上是Applet通常意义上的。

但是,JApplet 有许多普通 Applet 没有的额外结构。 由于这种结构,JApplet 的绘制是一件更加复杂的事情,并且由系统处理。

因此,当您创建 JApplet 的子类时,您不应该为其编写 paint() 方法。 正如我们将看到的,如果您想在 JApplet 上绘图,您应该向 applet 添加一个组件以用于该目的。 另一方面,您可以并且通常应该为 JApplet 的子类编写一个 init() 方法。

输入图片此处描述

Swing 是一大组组件,范围从非常简单的(例如标签)到非常复杂的(例如表格、树和样式文本文档)。
几乎所有 Swing 组件都派生自名为 JComponent 的单个父组件,该父组件扩展了 AWT Container 类。
因此,Swing 最好被描述为 AWT 之上的一层,而不是它的替代品。
如果将其与 AWT 组件层次结构进行比较,您会发现每个 AWT 组件都有一个带有前缀“J的 Swing 等效组件。
唯一的例外是 AWT Canvas 类,可以使用 JComponentJLabelJPanel作为替代品。 许多 Swing 类没有 AWT 对应类。

The 'J' was first put out by the KL Group (now quest.com) whose revolutionary BWT forms the basis of today's Improved AWT called Swing /JFC.

So, it comes from the ancestor of today's KL JClass:
(not so, according to TofuBeer's answer: I leave the rest as a Community Answer because it details what was JClass, but the 'J' may not come at all from the integration of their library into Swing.)

JClass SwingSuite, a new set of extensions and enhancements for Swing in Sun Microsystems, Inc.'s Java(TM) Development Kit (JDK(TM) version 1.2): it coincides with Sun's announcement of the availability of JDK 1.2 made today during the Java(SM) Business Expo(SM) in New York.

JClass JavaBeans are available in many popular Java IDEs and are the essential components used by professional and corporate developers around the world.
JClass 3.6 includes "J" versions, which work with the javax.swing package enabling the development and deployment with JDK 1.2 today.


From JClass 3.6 to 4.0 Porting Guide and KL Group Releases Swing Update for JClassLine (march 1998):

To accommodate the various types of environments Java developers may be using, we have developed versions of our JClass products that can be used for specific Java Development Kits (JDKs). The following lists the differences between the different versions:

  • "J" version: uses JDK 1.1 + Swing 1.1 (JDK 1.1.8 + Swing 1.1.1 are recommended)
  • "K" version: uses Java 2 (JDK 1.2.2 is recommended)

JClass 3.6 and prior versions used a slightly different letter scheme, which is as follows:

  • "T" version: uses the JDK 1.0.2 API and implements "Transitional" JavaBeans
  • "Unlettered" version: uses the JDK 1.1.x and incorporates full JavaBean implementation
  • "S" version: uses the JDK 1.1/Swing 1.0.3
  • "J" version: uses JDK 1.2 or JDK 1.1 with Swing 1.1

A bit of general context:

From The Basic Java Applet and JApplet:

The AWT (Abstract Windowing Toolkit) has been part of Java from the beginning, but, almost from the beginning, it has been clear that the AWT was not powerful or flexible enough for writing complex, sophisticated applications.

This does not prevent it from being useful -- especially for applets, which are generally not as complex as full-scale, independent applications.

The Swing graphical user interface library was created to address the problems with the AWT. With the release of Java version 1.2, Swing became an official part of Java. (Versions of Java starting with 1.2 are also called, rather confusingly, "Java 2.")

There are still good reasons to write applets based on the AWT, such as the lack of support in many Web browsers for Java 2. However, at this point, anyone writing a stand-alone graphical application in Java should almost certainly be using Swing.

The classes that make up the Swing library can be found in the package javax.swing. Swing includes the class javax.swing.JApplet to be used as a basis for writing applets.

JApplet is actually a subclass of Applet, so JApplets are in fact Applets in the usual sense.

However, JApplets have a lot of extra structure that plain Applets don't have. Because of this structure, the painting of a JApplet is a more complex affair and is handled by the system.

So, when you make a subclass of JApplet you should not write a paint() method for it. As we will see, if you want to draw on a JApplet, you should add a component to the applet to be used for that purpose. On the other hand, you can and generally should write an init() method for a subclass of JApplet.

enter image description here

Swing is a large set of components ranging from the very simple, such as labels, to the very complex, such as tables, trees, and styled text documents.
Almost all Swing components are derived from a single parent called JComponent which extends the AWT Container class.
Thus, Swing is best described as a layer on top of AWT rather than a replacement for it.
If you compare it with the AWT Component hierarchy, you will notice that for each AWT component there is a Swing equivalent with prefix “J.
The only exception to this is the AWT Canvas class, for which JComponent, JLabel, or JPanel can be used as a replacement. Many Swing classes have no AWT counterparts.

冬天旳寂寞 2024-07-22 04:30:39

J代表Java。 JSomeName 类与其“以前的”版本之间的主要区别在于,J-one 被设计为与 Swing(或任何其他图形工具包)一起使用,而其他类则从此时开始,仅 AWT 可用。

J stands for Java. The main difference between the JSomeName classes and their "previous" version, is that the J-ones where designed to be used with Swing (or any other graphical toolkit), while the others are from this time where only AWT was available.

痴者 2024-07-22 04:30:39

J 遵循 Swing 类中使用的约定。

根据 javadoc

java.applet.Applet 的扩展版本,添加了对 JFC/Swing 组件架构

JFC/Swing架构与AWT架构不同。

有几个区别,但最重要的是,AWT 使用本机代码来呈现小部件( SWT ) 而 Swing 是“轻量级”的,因为所有内容都是使用 Java 绘制的。

所以你的问题的答案

JApplet 中的“J”是什么意思?

表示它是一个支持 Swing 架构的 Applet。

我认为 TofuBeerVonC 是很好的答案,但它们没有解决(至少直接解决)你的问题。 相反,他们进一步解释了为什么 J 在 swing 组件中,并且不应该与 Sun 之外的其他类前面的大量其他 J 相混淆。

The J comes after the convention used in Swing classes.

According to the javadoc:

An extended version of java.applet.Applet that adds support for the JFC/Swing component architecture

JFC/Swing architecture is different from AWT architecture.

There are several differences, but the most significant is, AWT uses native code to render widgets ( so does SWT ) while Swing is "light weight" because all the is painted using Java.

So the answer to your question

What does the "J" in JApplet mean?

It means it is an Applet that supports Swing architecture.

I think TofuBeer and VonC are great answers, but they don't address ( at least directly ) your question. Instead they go further explaining why the J in swing components and should not be confused with tons of other J's in front of other classes outside Sun.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文