Documentation

The Java™ Tutorials
Hide TOC
About the JFC and Swing关于JFC和Swing
Trail: Creating a GUI With Swing
Lesson: Getting Started with Swing

About the JFC and Swing关于JFC和Swing

JFC is short for Java Foundation Classes, which encompass a group of features for building graphical user interfaces (GUIs) and adding rich graphics functionality and interactivity to Java applications. JFC是java基础类的缩写,它包含一组用于构建图形用户界面(GUI)的特性,并向java应用程序添加丰富的图形功能和交互性。It is defined as containing the features shown in the table below.定义为包含下表所示的特征。

Feature功能 Description描述
Swing GUI ComponentsSwing GUI组件 Includes everything from buttons to split panes to tables. 包括从按钮到拆分窗格到表格的所有内容。Many components are capable of sorting, printing, and drag and drop, to name a few of the supported features.许多组件能够排序、打印和拖放,仅举几个受支持的功能。
Pluggable Look-and-Feel Support可插拔的外观和感觉支持 The look and feel of Swing applications is pluggable, allowing a choice of look and feel. Swing应用程序的外观是可插入的,允许选择外观。For example, the same program can use either the Java or the Windows look and feel. 例如,同一个程序可以使用Java或Windows外观。Additionally, the Java platform supports the GTK+ look and feel, which makes hundreds of existing look and feels available to Swing programs. 此外,Java平台支持GTK+外观,这使数百个现有外观可用于Swing程序。Many more look-and-feel packages are available from various sources.更多的外观包可从各种来源获得。
Accessibility API可访问性API Enables assistive technologies, such as screen readers and Braille displays, to get information from the user interface.支持辅助技术(如屏幕阅读器和盲文显示器)从用户界面获取信息。
Java 2D API Enables developers to easily incorporate high-quality 2D graphics, text, and images in applications and applets. 使开发人员能够在应用程序和小程序中轻松整合高质量的2D图形、文本和图像。Java 2D includes extensive APIs for generating and sending high-quality output to printing devices.Java2D包含大量API,用于生成高质量输出并将其发送到打印设备。
Internationalization国际化 Allows developers to build applications that can interact with users worldwide in their own languages and cultural conventions. 允许开发人员构建能够以自己的语言和文化约定与世界各地的用户交互的应用程序。With the input method framework developers can build applications that accept text in languages that use thousands of different characters, such as Japanese, Chinese, or Korean.使用输入法框架,开发人员可以构建应用程序,接受使用数千种不同字符的语言(如日语、汉语或韩语)的文本。

This trail concentrates on the Swing components. 这条线索集中在Swing组件上。We help you choose the appropriate components for your GUI, tell you how to use them, and give you the background information you need to use them effectively. 我们帮助您为GUI选择合适的组件,告诉您如何使用它们,并为您提供有效使用它们所需的背景信息。We also discuss other features as they apply to Swing components.我们还讨论了应用于Swing组件的其他特性。

Which Swing Packages Should I Use?我应该使用哪些Swing软件包?

The Swing API is powerful, flexible — and immense. Swing API功能强大、灵活—并且巨大。The Swing API has 18 public packages:Swing API有18个公共包:

javax.accessibility javax.swing.plaf javax.swing.text
javax.swing javax.swing.plaf.basic javax.swing.text.html
javax.swing.border javax.swing.plaf.metal javax.swing.text.html.parser
javax.swing.colorchooser javax.swing.plaf.multi javax.swing.text.rtf
javax.swing.event javax.swing.plaf.synth javax.swing.tree
javax.swing.filechooser javax.swing.table javax.swing.undo

Fortunately, most programs use only a small subset of the API. 幸运的是,大多数程序只使用API的一小部分。This trail sorts out the API for you, giving you examples of common code and pointing you to methods and classes you're likely to need. 本教程为您整理API,提供常见代码的示例,并为您指出可能需要的方法和类。Most of the code in this trail uses only one or two Swing packages:本教程中的大多数代码仅使用一个或两个Swing包:


Previous page: Getting Started with Swing
Next page: Compiling and Running Swing Programs