Documentation

The Java™ Tutorials
Hide TOC
Trail: Creating a GUI with Swing
Lesson: Getting Started with Swing

Getting Started with Swing: ExamplesSwing入门:示例

Compiling and Running the Examples Locally在本地编译和运行示例

The second column in the table below has links to zip files for each demo that you can open and run in the NetBeans IDE. 下表中的第二列有指向每个演示的zip文件的链接,您可以在NetBeans IDE中打开并运行这些演示。Refer to Running Tutorial Examples in NetBeans IDE for more information.有关更多信息,请参阅在NetBeans IDE中运行教程示例

If you download an individual example, take care to have all the necessary files in the proper hierarchy when you compile and run it. 如果您下载了一个单独的示例,那么在编译和运行它时,请注意将所有必要的文件都放在适当的层次结构中。All of the examples in the Swing tutorial are placed in a package. Swing教程中的所有示例都放在一个包中。For example, the components examples are placed in a components package. 例如,组件示例放置在components包中。See the following image for the complete structure. 有关完整结构,请参阅下图。Note that any examples using images expect their image files to be in a directory named images that is in the same directory as the example's src files.请注意,任何使用图像的示例都希望其图像文件位于名为images的目录中,该目录与示例的src文件位于同一目录中。

Example实例 Zip File
(contains all files necessary for the example plus NetBeans IDE project metadata)(包含示例所需的所有文件以及NetBeans IDE项目元数据)
Source Files源文件 Image & Other Files图像及其他文件 Where Described描述的地方
HelloWorldSwing Hello World Swing Project HelloWorldSwing.java   Compiling and Running Swing Programs

Previous page:
Next page: