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发行说明。
The easiest way to learn about JavaBeans is to start using them. To begin, download and install the latest version of NetBeans. This tutorial describes how to use NetBeans version 7.0.了解JavaBeans最简单的方法是开始使用它们。首先,下载并安装最新版本的NetBeans。本教程介绍如何使用NetBeans 7.0版。
NetBeans is a bean builder tool, which means it recognizes JavaBeans components (beans) and enables you to snap components together into an application with ease.NetBeans是一个bean构建器工具,这意味着它可以识别JavaBeans组件(bean),并使您能够轻松地将组件组合到应用程序中。
Start NetBeans. Choose File > New Project... from the menu.启动NetBeans。从菜单上选择“文件”>“新建项目…”。
Select Java from the Categories list and select Java Application from the Projects list. Click Next >.从类别列表中选择Java,然后从项目列表中选择JavaApplication。单击下一步>。
Enter SnapApp as the application name. Uncheck Create Main Class and click Finish. NetBeans creates the new project and you can see it in NetBeans' Projects pane:输入SnapApp作为应用程序名称。取消选中创建主类,然后单击完成。NetBeans创建了新项目,您可以在NetBeans的项目窗格中看到它:
Control-click on the SnapApp project and choose New > JFrame Form... from the popup menu.控制单击SnapApp项目,然后从弹出菜单中选择新建>JFrame窗体。
Fill in SnapFrame for the class name and snapapp as the package. Click Finish. NetBeans creates the new class and shows its visual designer:填写SnapFrame作为类名,并将snapapp作为包。单击“完成”。NetBeans创建新类并显示其可视化设计器:
In the Projects pane on the left, you can see the newly created 在左侧的项目窗格中,您可以看到新创建的SnapFrame类。SnapFrame
class. In the center of the screen is the NetBeans visual designer. On the right side is the Palette, which contains all the components you can add to the frame in the visual designer.屏幕中央是NetBeans可视化设计器。右侧是调色板,其中包含您可以在可视化设计器中添加到框架中的所有组件。