The table that follows lists every example in the Using Swing Components lesson, with links to required files and to where each example is discussed. The first column of the table has links to JNLP files that let you run the examples using Java™ Web Start.
NOTE: Release 7.0 is required to run all applets and Java Web Start examples. Most examples will run on an earlier release but you must compile and run them locally.
To run an example using Java Web Start, click the [Launch] link in the first column of the table. The first time you run an example, there will be a delay while Java Web Start downloads the JAR file containing the class files for this lesson's examples. Afterward, the examples should execute more quickly.
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. Refer to
Running Tutorial Examples in NetBeans IDE for more information.
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. For example, the components examples are placed in a components
package. 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.
Here is a typical setup:
You can find out which files each example needs by consulting the following table or by looking at the comments at the beginning of each source file.
例子 |
Zip File
(contains all files necessary for the example plus NetBeans IDE project metadata) |
Source Files
(first file has the main method, except for examples that run only as applets) |
Image and Other Files |
Where Described |
BorderDemo [Launch]
|
Border Demo Project |
BorderDemo.java |
wavy.gif |
如何使用边框 |
ButtonDemo [Launch]
|
Button Demo Project |
ButtonDemo.java |
right.gif , middle.gif , left.gif |
How to Use Buttons, ... |
ButtonHtmlDemo [Launch]
|
Button Html Demo Project |
ButtonHtmlDemo.java |
right.gif , middle.gif , left.gif |
How to Use Buttons, ... |
CheckBoxDemo [Launch]
|
Check Box Demo Project |
CheckBoxDemo.java |
All of the images in the images/geek directory. |
How to Use Buttons, ... |
ColorChooserDemo [Launch]
|
Color Chooser Demo Project |
ColorChooserDemo.java |
|
如何使用颜色选择器 |
ColorChooserDemo2 [Launch]
|
Color Chooser 2 Demo Project |
ColorChooserDemo2.java
CrayonPanel.java |
red.gif , yellow.gif , green.gif , blue.gif |
如何使用颜色选择器 |
ComboBoxDemo [Launch]
|
Combo Box Demo Project |
ComboBoxDemo.java |
Bird.gif , Cat.gif , Dog.gif , Rabbit.gif , Pig.gif |
如何使用组合框 |
ComboBoxDemo2 [Launch]
|
Combo Box 2 Demo Project |
ComboBoxDemo2.java |
|
如何使用组合框 |
Converter [Launch]
|
Converter Project |
Converter.java
ConversionPanel.java
ConverterRangeModel.java
FollowerRangeModel.java
Unit.java |
|
如何使用面板;
Using Models |
CustomComboBoxDemo [Launch]
|
Custom Combo Box Demo Project |
CustomComboBoxDemo.java |
Bird.gif , Cat.gif , Dog.gif , Rabbit.gif , Pig.gif |
如何使用组合框 |
CustomIconDemo [Launch]
|
Custom Icon Demo Project |
CustomIconDemo.java
ArrowIcon.java |
middle.gif |
如何使用图标 |
DialogDemo [Launch]
|
Dialog Demo Project |
DialogDemo.java
CustomDialog.java |
middle.gif |
How to Use Dialogs |
DynamicTreeDemo [Launch]
|
Dynamic Tree Demo Project |
DynamicTreeDemo.java
DynamicTree.java |
|
如何使用树 |
FileChooserDemo* |
File Chooser Demo Project |
FileChooserDemo.java |
Open16.gif , Save16.gif |
如何使用文件选择器 |
FileChooserDemo2* |
File Chooser 2 Demo Project |
FileChooserDemo2.java
ImageFileView.java
ImageFilter.java
ImagePreview.java
Utils.java |
jpgIcon.gif , gifIcon.gif , tiffIcon.gif , pngIcon.png |
如何使用文件选择器 |
FormattedTextFieldDemo [Launch]
|
Formatted Text Field Demo Project |
FormattedTextFieldDemo.java |
|
如何使用格式化文本框 |
FormatterFactoryDemo [Launch]
|
Formatter Factory Demo Project |
FormatterFactoryDemo.java |
|
如何使用格式化文本框 |
FrameDemo [Launch]
|
Frame Demo Project |
FrameDemo.java |
|
How to Make Frames |
FrameDemo2 [Launch]
|
Frame 2 Demo Project |
FrameDemo2.java |
FD.jpg |
How to Make Frames |
Framework [Launch]
|
Framework Project |
Framework.java |
|
Nowhere |
GenealogyExample [Launch]
|
Genealogy Example Project |
GenealogyExample.java
GenealogyModel.java
GenealogyTree.java
Person.java |
|
如何使用树 |
GlassPaneDemo [Launch]
|
Glass Pane Demo Project |
GlassPaneDemo.java |
|
如何使用根窗格 |
HtmlDemo [Launch]
|
Html Demo Project |
HtmlDemo.java |
|
Using HTML in Swing Components |
IconDemo [Launch]
|
Icon Demo Project |
IconDemoApp.java
MissingIcon.java |
sunw01.jpg , sunw02.jpg , sunw03.jpg , sunw04.jpg , sunw05.jpg |
如何使用图标 |
InternalFrameDemo [Launch]
|
Internal Frame Demo Project |
InternalFrameDemo.java
MyInternalFrame.java |
|
如何使用内部框架 |
JWSFileChooserDemo [Launch]
|
JWS File Chooser Demo Project |
JWSFileChooserDemo.java |
Open16.gif , Save16.gif |
如何使用文件选择器 |
LabelDemo [Launch]
|
Label Demo Project |
LabelDemo.java |
middle.gif |
如何使用标签 |
LayeredPaneDemo [Launch]
|
Layered Pane Demo Project |
LayeredPaneDemo.java |
dukeWaveRed.gif |
如何使用分层窗格 |
LayeredPaneDemo2 [Launch]
|
Layered Pane 2 Demo Project |
LayeredPaneDemo2.java |
dukeWaveRed.gif |
如何使用分层窗格 |
ListDemo [Launch]
|
List Demo Project |
ListDemo.java |
|
如何使用列表 |
ListDialogRunner [Launch]
|
List Dialog Runner Project |
ListDialogRunner.java
ListDialog.java |
|
How to Use Buttons, ... |
MenuDemo [Launch]
|
Menu Demo Project |
MenuDemo.java |
middle.gif |
如何使用菜单 |
MenuGlueDemo [Launch]
|
Menu Glue Demo Project |
MenuGlueDemo.java |
|
如何使用菜单 |
MenuLayoutDemo [Launch]
|
Menu Layout Demo Project |
MenuLayoutDemo.java |
|
如何使用菜单 |
MenuLookDemo [Launch]
|
Menu Look Demo Project |
MenuLookDemo.java |
middle.gif |
如何使用菜单 |
MenuSelectionManagerDemo [Launch]
|
Menu Selection Manager Demo Project |
MenuSelectionManagerDemo.java |
middle.gif |
如何使用菜单 |
PasswordDemo [Launch]
|
Password Demo Project |
PasswordDemo.java |
|
如何使用密码框 |
PopupMenuDemo [Launch]
|
Popup Menu Demo Project |
PopupMenuDemo.java |
middle.gif |
如何使用菜单 |
ProgressBarDemo [Launch]
|
Progress Bar Demo Project |
ProgressBarDemo.java |
|
How to Monitor Progress |
ProgressBarDemo2 [Launch]
|
Progress Bar 2 Demo Project |
ProgressBarDemo2.java |
|
How to Monitor Progress |
ProgressMonitorDemo [Launch]
|
Progress Monitor Demo Project |
ProgressMonitorDemo.java |
|
How to Monitor Progress |
RadioButtonDemo [Launch]
|
Radio Button Demo Project |
RadioButtonDemo.java |
Bird.gif , Cat.gif , Dog.gif , Rabbit.gif , Pig.gif |
How to Use Buttons, ... |
RootLayeredPane [Launch]
|
Root Layered Pane Demo Project |
RootLayeredPaneDemo.java |
dukeWaveRed.gif |
如何使用根窗格 |
ScrollDemo [Launch]
|
Scroll Demo Project |
ScrollDemo.java
Rule.java
Corner.java
ScrollablePicture.java |
flyingBee.jpg |
如何使用滚动窗格 |
ScrollDemo2 [Launch]
|
Scroll 2 Demo Project |
ScrollDemo2.java |
|
如何使用滚动窗格 |
SharedModelDemo [Launch]
|
Shared Model Demo Project |
SharedModelDemo.java
|
|
Using Models |
SimpleTableDemo [Launch]
|
Simple Table Demo Project |
SimpleTableDemo.java |
|
如何使用表格 |
SimpleTableSelectionDemo [Launch]
|
Simple Table Selection Demo Project |
SimpleTableSelectionDemo.java |
|
如何使用表格 |
SliderDemo [Launch]
|
Slider Demo Project |
SliderDemo.java |
All of the images in the images/doggy directory. |
如何使用滑块 |
SliderDemo2 [Launch]
|
Slider 2 Demo Project |
SliderDemo2.java |
All of the images in the images/doggy directory. |
如何使用滑块 |
SpinnerDemo [Launch]
|
Spinner Demo Project |
SpinnerDemo.java
SpringUtilities.java
CyclingSpinnerListModel.java |
|
如何使用微调器 |
SpinnerDemo2 [Launch]
|
Spinner 2 Demo Project |
SpinnerDemo2.java
SpinnerDemo.java
SpringUtilities.java
CyclingSpinnerListModel.java |
|
如何使用微调器 |
SpinnerDemo3 [Launch]
|
Spinner Demo 3 Project |
SpinnerDemo3.java
SpringUtilities.java
CyclingSpinnerListModel.java |
|
如何使用微调器 |
SpinnerDemo4 [Launch]
|
Spinner Demo 4 Project |
SpinnerDemo4.java
SpringUtilities.java |
|
如何使用微调器 |
SplitPaneDemo [Launch]
|
Split Pane Demo Project |
SplitPaneDemo.java |
image files |
如何使用拆分窗格 |
SplitPaneDemo2 [Launch]
|
Split Pane 2 Demo Project |
SplitPaneDemo2.java |
image files |
如何使用拆分窗格 |
SplitPaneDividerDemo [Launch]
|
Split Pane Divider Demo Project |
SplitPaneDividerDemo.java
SizeDisplayer.java |
Cat.gif , Dog.gif |
如何使用拆分窗格 |
TabbedPaneDemo [Launch]
|
Tabbed Pane Demo Project |
TabbedPaneDemo.java |
middle.gif |
如何使用选项卡式窗格 |
TabComponentsDemo [Launch]
|
Tab Components Demo Project |
TabComponentsDemo.java
ButtonTabComponent.java |
|
如何使用选项卡式窗格 |
TableDemo [Launch]
|
Table Demo Project |
TableDemo.java |
|
如何使用表格 |
TableDialogEditDemo [Launch]
|
Table Dialog Edit Demo Project |
TableDialogEditDemo.java
ColorEditor.java
ColorRenderer.java |
|
如何使用表格 |
TableFTFEditDemo [Launch]
|
Table FTF Edit Demo Project |
TableFTFEditDemo.java
IntegerEditor.java |
|
如何使用表格 |
TableFilterDemo [Launch]
|
Table Filter Demo Project |
TableFilterDemo.java
SpringUtilities.java |
|
如何使用表格 |
TablePrintDemo [Launch]
|
Table Print Demo Project |
TablePrintDemo.java |
|
如何使用表格 |
TableRenderDemo [Launch]
|
Table Render Demo Project |
TableRenderDemo.java |
|
如何使用表格 |
TableSelectionDemo [Launch]
|
Table Selection Demo Project |
TableSelectionDemo.java |
|
如何使用表格 |
TableSortDemo [Launch]
|
Table Sort Demo Project |
TableSortDemo.java |
|
如何使用表格 |
TableToolTipsDemo [Launch]
|
Table Tool Tips Demo Project |
TableToolTipsDemo.java |
|
如何使用表格 |
TextAreaDemo [Launch]
|
Text Area Demo Project |
TextAreaDemo.java |
|
How to Use Text Areas |
TextComponentDemo [Launch]
|
Text Component Demo Project |
TextComponentDemo.java
DocumentSizeFilter.java |
|
文本组件功能 |
TextDemo [Launch]
|
Text Demo Project |
TextDemo.java |
|
How to Use Text Fieldsand How to Use Text Areas |
TextFieldDemo [Launch]
|
Text Field Demo Project |
TextFieldDemo.java |
content.txt |
How to Use Text Fields |
TextInputDemo [Launch]
|
Text Input Demo Project |
TextInputDemo.java
SpringUtilities.java |
|
如何使用格式化文本框 |
TextSamplerDemo [Launch]
|
Text Sampler Demo Project |
TextSamplerDemo.java |
Pig.gif , sound.gif , dukeWaveRed.gif , TextSamplerDemoHelp.html |
Using Text Componentsand How to Use Editor Panes and Text Panes |
ToolBarDemo [Launch]
|
Tool Bar Demo Project |
ToolBarDemo.java |
Back24.gif , Forward24.gif , Up24.gif |
如何使用工具栏 |
ToolBarDemo2 [Launch]
|
Tool Bar 2 Demo Project |
ToolBarDemo2.java |
Back24.gif , Forward24.gif , Up24.gif |
如何使用工具栏 |
TopLevelDemoProject [Launch]
|
Top Level Demo Project |
TopLevelDemo.java |
|
使用顶级容器 |
TreeDemo [Launch]
|
Tree Demo Project |
TreeDemo.java |
Several html files. |
如何使用树 |
TreeIconDemo [Launch]
|
Tree Icon Demo Project |
TreeIconDemo.java |
middle.gif and several html files. |
如何使用树 |
TreeIconDemo2 [Launch]
|
Tree Icon 2 Demo Project |
TreeIconDemo2.java |
middle.gif and several html files. |
如何使用树 |
TumbleItem |
Tumble Item Project |
TumbleItem.java (an applet) |
All of the images in the images/tumble directory. |
如何制作 applet |
* This application is not currently available with Java Web Start. To run it, download and compile it, and then run it as an application.
geek-----.gif
, geek-c---.gif
, geek--g--.gif
, geek---h-.gif
,
geek----t.gif
, geek-cg--.gif
, geek-c-h-.gif
, geek-c--t.gif
,
geek--gh-.gif
, geek--g-t.gif
, geek---h-.gif
, geek-cg-t.gif
,
geek-cgh-.gif
, geek-c-ht.gif
, geek--ght.gif
, geek-cght.gif
T0.gif
, T1.gif
, T2.gif
, T3.gif
, T4.gif
, T5.gif
, T6.gif
,
T7.gif
, T8.gif
, T9.gif
, T10.gif
, T11.gif
, T12.gif
, T13.gif
T1.gif
, T2.gif
, T3.gif
, T4.gif
, T5.gif
,
T6.gif
, T7.gif
, T8.gif
, T9.gif
, T10.gif
,
T11.gif
, T12.gif
, T13.gif
, T14.gif
, T15.gif
,
T16.gif
, T17.gif
Bird.gif
, Cat.gif
, Dog.gif
, Rabbit.gif
, Pig.gif
, dukeWaveRed.gif
, kathyCosmo.gif
, lainesTongue.gif
, left.gif
, middle.gif
, right.gif
, stickerface.gif
TreeDemoHelp.html
arnold.html
bloch.html
chanlee.html
jls.html
swingtutorial.html
tutorial.html
tutorialcont.html
vm.html