The Java Tutorials have been written for JDK 8.Java教程是为JDK 8编写的。Examples and practices described in this page don't take advantage of improvements introduced in later releases and might use technology no longer available.本页中描述的示例和实践没有利用后续版本中引入的改进,并且可能使用不再可用的技术。See Java Language Changes for a summary of updated language features in Java SE 9 and subsequent releases.有关Java SE 9及其后续版本中更新的语言特性的摘要,请参阅Java语言更改。
See JDK Release Notes for information about new features, enhancements, and removed or deprecated options for all JDK releases.有关所有JDK版本的新功能、增强功能以及已删除或不推荐的选项的信息,请参阅JDK发行说明。
Java rich internet applications (RIA) are applications that have traits similar to desktop applications, but are deployed via the Internet.Java富internet应用程序(RIA)是具有类似于桌面应用程序特性的应用程序,但通过internet部署。Java RIAs may be developed and deployed as Java applets or Java Web Start applications.Java RIA可以作为Java小程序或Java Web Start应用程序开发和部署。
In the past, the decision of whether to deploy a Java rich internet application inside the browser as an applet, or outside the browser as a Java Web Start application, could significantly impact the design of the application.在过去,是将Java富Internet应用程序作为小程序部署在浏览器内部,还是将其作为Java Web Start应用程序部署在浏览器外部的决策可能会对应用程序的设计产生重大影响。With the latest Java Plug-in, this decision has been greatly simplified.有了最新的Java插件,这个决定大大简化了。
Traditionally, applications construct their user interfaces, including the top-level 传统上,应用程序使用Frame
, in the main
method.main
方法构建其用户界面,包括顶级Frame
。This programming style prevents easy re-deployment of the application in the browser, because it assumes that the application creates its own 这种编程风格防止在浏览器中轻松重新部署应用程序,因为它假定应用程序创建自己的Frame
.Frame
。When running in the browser as an applet, the applet is the top level container that should hold the user interface for the application.当小程序作为小程序在浏览器中运行时,小程序是顶级容器,应该包含应用程序的用户界面。A top-level 不需要顶层Frame
is not needed.Frame
。
Use component-based architecture when designing your Java rich internet application.设计Java富internet应用程序时,请使用基于组件的体系结构。Try to organize its functionality into one or more components that can be composed together.尝试将其功能组织成一个或多个可以组合在一起的组件。In this context, the term "component" refers to a GUI element that is a subclass of the AWT 在此上下文中,术语“组件”指的是作为AWT组件类、Swing JComponent类或其他子类的子类的GUI元素。Component
class, the Swing JComponent
class, or another subclass.For example, you could have a top level 例如,您可以有一个顶级JPanel
which contains other UI components in it (like a combination of more nested JPanels and text fields, combo boxes etc.).JPanel
,其中包含其他UI组件(如更多嵌套JPanel和文本字段、组合框等的组合)。With such a design, it becomes relatively easy to deploy the core functionality as an applet or a Java Web Start application.通过这种设计,将核心功能部署为applet或Java Web Start应用程序变得相对容易。
To deploy as a Java applet, you just need to wrap the core functionality in an 要部署为Java小程序,只需将核心功能包装在Applet
or JApplet
and add the browser specific functionality, if necessary.Applet
或JApplet
中,并在必要时添加特定于浏览器的功能。To deploy as a Java Web Start application, wrap the functionality in a 要部署为Java Web Start应用程序,请将功能包装在JFrame
.JFrame
中。
The Rich Internet Applications Decision Guide contains detailed information to help you decide whether to deploy your code as a Java applet or Java Web Start application.富Internet应用程序决策指南包含详细信息,可帮助您决定是将代码部署为Java小程序还是Java Web Start应用程序。
Self-contained applications provide a deployment option that does not require a browser.自包含应用程序提供了一个不需要浏览器的部署选项。Users install your application locally and run it similar to native applications.用户在本地安装您的应用程序,并以与本机应用程序类似的方式运行它。Self-contained applications include the JRE needed to run the application, so users always have the correct JRE.自包含的应用程序包括运行应用程序所需的JRE,因此用户始终拥有正确的JRE。
This trail discusses the development and deployment of RIAs and self-contained applications.本教程讨论RIA和自包含应用程序的开发和部署。See What's New for capabilities introduced in various versions of the client Java Runtime Environment (JRE) software.请参阅各种版本的客户端Java运行时环境(JRE)软件中引入的功能的新增功能。
➤ Developing and Deploying Java Applets开发和部署Java小程序
➤ Developing and Deploying Java Web Start Applications开发和部署Java Web Start应用程序
➤ Doing More With Java Rich Internet Applications利用Java富Internet应用程序做更多事情
➤ Deploying Self-Contained Applications部署自包含的应用程序
Supporting Tools辅助工具