当前页面:
在线文档首页 >
Java Tutorial 5.0 英文版
Using Swing Components: Examples (1.1/1.2) - Java Tutorial 5.0 英文版
The JavaTM Tutorial
Trail: Creating a GUI with JFC/Swing
Lesson: Using Swing Components
Using Swing Components: Examples (1.1/1.2)
The table that follows lists every 1.1/1.2 example in the Using Swing Components lesson, with links to required files and to where each example is discussed.
Note: These examples use the Swing 1.1 API, which is supported by J2SE 1.2 and compatible releases, as well as JDK 1.1 + JFC/Swing 1.1.
To see more up-to-date
versions of these examples
that can be launched using JavaTM Web Start,
see the
list of 1.4 examples.
Examples
are applications
unless noted otherwise.
See
Getting Started with Swing for details about releases and
instructions on compiling and running programs.
You can get the source, image, and other files required
for all these examples
by downloading the
Tutorial Examples bundle, which contains the files in the correct hierarchy.
If you download an individual example,
take care to have all the necessary files
in the proper hierarchy when you compile and run it.
For example, many examples
expect their image files
to be in a directory named images
that's in the same directory as the example's class files.
Here's a typical setup:
Some examples, such as
CheckBoxDemo
and
SliderDemo
,
require the image files to be in a subdirectory of
the images
directory.
Source Files |
Image & Other Files |
Where Described |
ButtonDemo.java
|
right.gif ,
middle.gif ,
left.gif |
How to Use Buttons, ... |
CheckBoxDemo.java
|
All of the images in the
images/geek directory. |
How to Use Buttons, ... |
ColorChooserDemo.java
|
|
How to Use Color Choosers |
ColorChooserDemo2.java
CrayonPanel.java
|
red.gif ,
yellow.gif ,
green.gif ,
blue.gif |
How to Use Color Choosers |
ComboBoxDemo.java
|
Bird.gif ,
Cat.gif ,
Dog.gif ,
Rabbit.gif ,
Pig.gif |
How to Use Combo Boxes |
ComboBoxDemo2.java
|
|
How to Use Combo Boxes |
CustomComboBoxDemo.java
|
Bird.gif ,
Cat.gif ,
Dog.gif ,
Rabbit.gif ,
Pig.gif |
How to Use Combo Boxes |
DialogDemo.java
CustomDialog.java
|
middle.gif |
How to Use Dialogs |
DynamicTreeDemo.java
DynamicTree.java
|
|
How to Use Trees |
FileChooserDemo.java
|
open.gif ,
save.gif |
How to Use File Choosers |
FileChooserDemo2.java
ImageFileView.java
ImageFilter.java
ImagePreview.java
Utils.java
|
jpgIcon.gif ,
gifIcon.gif ,
tiffIcon.gif |
How to Use File Choosers |
FrameDemo.java
|
|
How to Make Frames |
Framework.java
|
|
Nowhere |
GenealogyExample.java
GenealogyModel.java
GenealogyTree.java
Person.java
|
|
How to Use Trees |
GlassPaneDemo.java
|
|
How to Use Root Panes |
HtmlDemo.java
|
|
How to Use Labels |
InternalFrameDemo.java
MyInternalFrame.java
|
|
How to Use Internal Frames |
LabelDemo.java
|
middle.gif |
How to Use Labels |
LayeredPaneDemo.java
|
dukeWaveRed.gif |
How to Use Layered Panes |
LayeredPaneDemo2.java
|
dukeWaveRed.gif |
How to Use Layered Panes |
ListDemo.java
|
|
How to Use Lists |
ListDialog.java
|
|
How to Use Buttons, ... |
MenuLookDemo.java
|
middle.gif |
How to Use Menus |
MenuDemo.java
|
middle.gif |
How to Use Menus |
MenuGlueDemo.java
|
|
How to Use Menus |
MenuLayoutDemo.java
|
|
How to Use Menus |
PasswordDemo.java
|
|
How to Use Text Fields |
PopupMenuDemo.java
|
middle.gif |
How to Use Menus |
ProgressBarDemo.java
LongTask.java
SwingWorker.java
|
|
How to Monitor Progress |
ProgressMonitorDemo.java
LongTask.java
SwingWorker.java
|
|
How to Monitor Progress |
RadioButtonDemo.java
|
Bird.gif ,
Cat.gif ,
Dog.gif ,
Rabbit.gif ,
Pig.gif |
How to Use Buttons, ... |
ScrollDemo.java
Rule.java
Corner.java
ScrollablePicture.java
|
youngdad.jpeg |
How to Use Scroll Panes |
ScrollDemo2.java
|
|
How to Use Scroll Panes |
SharedModelDemo.java
|
|
Nowhere |
SimpleTableDemo.java
|
|
How to Use Tables |
SimpleTableSelectionDemo.java
|
|
How to Use Tables |
SliderDemo.java
|
All of the images in the
images/doggy directory. |
How to Use Sliders |
SliderDemo2.java
|
All of the images in the
images/doggy directory. |
How to Use Sliders |
SplitPaneDemo.java
|
imagenames.properties
and all of the image files
listed in it. |
How to Use Split Panes |
SplitPaneDemo2.java
|
imagenames.properties
and all of the image files
listed in it. |
How to Use Split Panes |
TabbedPaneDemo.java
|
middle.gif |
How to Use Tabbed Panes |
TableDemo.java
|
|
How to Use Tables |
TableEditDemo.java
WholeNumberField.java
|
|
How to Use Tables |
TableDialogEditDemo.java
WholeNumberField.java
|
|
How to Use Tables |
TableRenderDemo.java
|
|
How to Use Tables |
TableSorterDemo.java
TableMap.java
TableSorter.java
|
|
How to Use Tables |
TextComponentDemo.java
LimitedStyledDocument.java
|
|
General Rules for Using Text Components |
TextDemo.java
(an applet)
|
|
How to Use Text Fields |
TextFieldDemo.java
DecimalField.java
FormattedDocument.java
WholeNumberField.java
|
|
How to Use Text Fields |
TextSamplerDemo.java |
Pig.gif ,
sound.gif ,
dukeWaveRed.gif ,
TextSamplerDemoHelp.html
|
Using Text Components |
ToolBarDemo.java
|
right.gif ,
middle.gif ,
left.gif |
How to Use Tool Bars |
ToolBarDemo2.java
|
right.gif ,
middle.gif ,
left.gif |
How to Use Tool Bars |
TopLevelDemo.java
|
|
Using Top-Level Containers |
TreeDemo.java
|
Several html files. |
How to Use Trees |
TreeIconDemo.java
|
middle.gif
and several html files. |
How to Use Trees |
TreeIconDemo2.java
|
middle.gif
and several html files. |
How to Use Trees |
TumbleItem.java
(an applet)
SwingWorker.java
|
All of the images in the
images/tumble directory.
|
How to Make Applets |
Geek Images
geek-----.gif
,
geek-c---.gif
,
geek--g--.gif
,
geek---h-.gif
,
geek----g.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
Doggy Images
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
Tumble Images
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
Images listed in imagenames.properties
Bird.gif
,
Cat.gif
,
Dog.gif
,
Rabbit.gif
,
Pig.gif
,
all.gif
,
blue.gif
,
doggy/T1.gif
,
dukeWaveRed.gif
,
geek/geek-cght.gif
,
green.gif
,
kathyCosmo.gif
,
lainesTongue.gif
,
left.gif
,
middle.gif
,
red.gif
,
right.gif
,
smallbabies.jpeg
,
sophie.gif
,
stickerface.gif
,
tumble/T7.gif
,
yellow.gif
,
youngdad.jpeg
,
HTML Files Required for Tree Demos
TreeDemoHelp.html
tutorial.html
tutorialcont.html
swingtutorial.html
arnold.html
faq.html
chanlee.html
thread.html
vm.html
jls.html
Copyright
1995-2005 Sun Microsystems, Inc. All rights reserved.