java 小程序和 SWING 有什么区别?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/1919410/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
What is the difference between applets and SWING?
提问by sevugarajan
What is the difference between applets and SWING?
小程序和 SWING 有什么区别?
回答by rahul
See Applets
查看小程序
An applet is a program written in the Java programming language that can be included in an HTML page, much in the same way an image is included in a page. When you use a Java technology-enabled browser to view a page that contains an applet, the applet's code is transferred to your system and executed by the browser's Java Virtual Machine (JVM).
小程序是用 Java 编程语言编写的程序,可以包含在 HTML 页面中,这与将图像包含在页面中的方式非常相似。当您使用支持 Java 技术的浏览器查看包含小程序的页面时,小程序的代码将传输到您的系统并由浏览器的 Java 虚拟机 (JVM) 执行。
See Swing (Java)
请参阅Swing (Java)
Swing is a widget toolkit for Java. It is part of Sun Microsystems' Java Foundation Classes (JFC) — an API for providing a graphical user interface (GUI) for Java programs.
Swing was developed to provide a more sophisticated set of GUI components than the earlier Abstract Window Toolkit. Swing provides a native look and feel that emulates the look and feel of several platforms, and also supports a pluggable look and feel that allows applications to have a look and feel unrelated to the underlying platform.
Swing 是一个用于 Java 的小部件工具包。它是 Sun Microsystems 的 Java Foundation Classes (JFC) 的一部分 — 一种用于为 Java 程序提供图形用户界面 (GUI) 的 API。
Swing 的开发目的是提供一组比早期抽象窗口工具包更复杂的 GUI 组件。Swing 提供了一种模拟多种平台外观的本机外观,还支持可插拔外观,允许应用程序具有与底层平台无关的外观。
回答by Jeff
An applet is a small program that often runs in a web browser Java plugin.
小程序是一个小程序,通常在 Web 浏览器 Java 插件中运行。
A swing is a piece of playground equipment usually consisting of a seat suspended by two chains or ropes. It's quite fun. :)
秋千是一种游乐场设备,通常由一个由两条链条或绳索悬挂的座椅组成。这很有趣。:)
In all seriousness, though, Swing is a Java GUI library. It provides components such as buttons and text fields. You can use Swing components in an applet.
不过,严肃地说,Swing 是一个 Java GUI 库。它提供了按钮和文本字段等组件。您可以在小程序中使用 Swing 组件。
回答by adsk
Applets will be downloaded at the client web browser and executed locally where as swing has a set of APIs for developing GUI components and can act as stand alone applications.
小程序将在客户端 Web 浏览器上下载并在本地执行,而 Swing 有一组用于开发 GUI 组件的 API,并且可以充当独立的应用程序。
回答by spork
Short answer: Appletsare intended to be small bits of functionality run in a web browser and downloaded on-demand. Swingis a collection of user interface components, like text boxes and windows, that are meant to be assembled by a developer for use on the desktop.
简短回答:Applets旨在成为在 Web 浏览器中运行并按需下载的少量功能。Swing是一组用户界面组件,如文本框和窗口,旨在由开发人员组装以在桌面上使用。
Long answer: See adamantium's answer.
长答案:见adamantium的答案。
回答by Pool
I think the confusion is with all the terminology you initially encounter when building applets.
我认为混淆在于您在构建小程序时最初遇到的所有术语。
Appletis the overall name for a programme that runs in a Java sandbox in a web browser. It is also a specific Java class (java.applet.Applet). The entry class of this programme must extend Applet.
Applet是在 Web 浏览器的 Java 沙箱中运行的程序的总称。它也是一个特定的 Java 类 ( java.applet.Applet)。这个程序的入口类必须扩展Applet。
Applets originally (upto Java version 1.1) could only use AWTuser interface components.
小程序最初(直到 Java 1.1 版)只能使用AWT用户界面组件。
Since Java version 1.3 Swingcomponents may be used instead. In this case your entry class must extend JApplet.
回答by MahesH Giri
Swing :- Swing is light weight component . Swing have it's own layout like most popular box layout. Swing have some thread rules.
Swing:- Swing 是轻量级组件。Swing 有自己的布局,就像最流行的盒子布局一样。Swing 有一些线程规则。
Applet :-
小程序:-
Applet is heavy weight component. Applet uses AWT layout like flowlayout. Applet doesn't have any rules.
Applet 是重量级的组件。Applet 使用类似 flowlayout 的 AWT 布局。Applet 没有任何规则。
回答by komal jain
Swing is light weight Component.
Applet is heavy weight Component.Swing have look and feel according to user view you can change look and feel using UIManager.
Applet Does not provide this facility.Swing uses for stand lone Applications, Swing have main method to execute the program.
Applet need HTML code for Run the Applet.Swing uses MVC Model view Controller.
Applet not.Swing have its own Layout like most popular Box Layout. Applet uses AWT Layouts like flowlayout.
Swing have some Thread rules.
Applet doesn't have any rule.Swing:-To execute Swing no need any browser By which we can create stand alone application But Here we have to add container and maintain all action control with in frame container.
Swing 是轻量级组件。
Applet 是重量级的组件。Swing 具有根据用户视图的外观和感觉,您可以使用 UIManager 更改外观和感觉。
Applet 不提供此功能。Swing 用于独立应用程序,Swing 有执行程序的主要方法。
Applet 需要 HTML 代码来运行 Applet。Swing 使用 MVC 模型视图控制器。
小程序没有。Swing 有自己的布局,就像最流行的 Box Layout。Applet 使用类似 flowlayout 的 AWT 布局。
Swing 有一些线程规则。
Applet 没有任何规则。Swing:-执行 Swing 不需要任何浏览器,我们可以通过它创建独立的应用程序但是在这里我们必须添加容器并使用框架容器维护所有动作控制。
Applet: to execute Applet program we should need any browser like AppletViewer, a web browser. Because Applet is using browser container to run and all action control with in browser container.
Applet:要执行 Applet 程序,我们需要任何浏览器,例如 AppletViewer,一个 Web 浏览器。因为 Applet 使用浏览器容器运行,所有动作控制都在浏览器容器中。

