The JavaTM Tutorial
Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

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 (in the Creating a GUI with JFC/Swing trail).

Examples are applications unless noted otherwise. See Getting Started with Swing (in the Creating a GUI with JFC/Swing trail) 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 (outside of the tutorial), 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:

Directory structure

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 (in a .java source file) right.gif, middle.gif, left.gif How to Use Buttons, ...
CheckBoxDemo.java (in a .java source file) All of the images in the images/geek directory. How to Use Buttons, ...
ColorChooserDemo.java (in a .java source file)   How to Use Color Choosers
ColorChooserDemo2.java (in a .java source file)
   CrayonPanel.java (in a .java source file)
red.gif, yellow.gif, green.gif, blue.gif How to Use Color Choosers
ComboBoxDemo.java (in a .java source file) Bird.gif, Cat.gif, Dog.gif, Rabbit.gif, Pig.gif How to Use Combo Boxes
ComboBoxDemo2.java (in a .java source file)   How to Use Combo Boxes
CustomComboBoxDemo.java (in a .java source file) Bird.gif, Cat.gif, Dog.gif, Rabbit.gif, Pig.gif How to Use Combo Boxes
DialogDemo.java (in a .java source file)
   CustomDialog.java (in a .java source file)
middle.gif How to Use Dialogs
DynamicTreeDemo.java (in a .java source file)
   DynamicTree.java (in a .java source file)
  How to Use Trees
FileChooserDemo.java (in a .java source file) open.gif, save.gif How to Use File Choosers
FileChooserDemo2.java (in a .java source file)
   ImageFileView.java (in a .java source file)
   ImageFilter.java (in a .java source file)
   ImagePreview.java (in a .java source file)
   Utils.java (in a .java source file)
jpgIcon.gif, gifIcon.gif, tiffIcon.gif How to Use File Choosers
FrameDemo.java (in a .java source file)   How to Make Frames
Framework.java (in a .java source file)   Nowhere
GenealogyExample.java (in a .java source file)
   GenealogyModel.java (in a .java source file)
   GenealogyTree.java (in a .java source file)
   Person.java (in a .java source file)
  How to Use Trees
GlassPaneDemo.java (in a .java source file)   How to Use Root Panes
HtmlDemo.java (in a .java source file)   How to Use Labels
InternalFrameDemo.java (in a .java source file)
   MyInternalFrame.java (in a .java source file)
  How to Use Internal Frames
LabelDemo.java (in a .java source file) middle.gif How to Use Labels
LayeredPaneDemo.java (in a .java source file) dukeWaveRed.gif How to Use Layered Panes
LayeredPaneDemo2.java (in a .java source file) dukeWaveRed.gif How to Use Layered Panes
ListDemo.java (in a .java source file)   How to Use Lists
ListDialog.java (in a .java source file)   How to Use Buttons, ...
MenuLookDemo.java (in a .java source file) middle.gif How to Use Menus
MenuDemo.java (in a .java source file) middle.gif How to Use Menus
MenuGlueDemo.java (in a .java source file)   How to Use Menus
MenuLayoutDemo.java (in a .java source file)   How to Use Menus
PasswordDemo.java (in a .java source file)   How to Use Text Fields
PopupMenuDemo.java (in a .java source file) middle.gif How to Use Menus
ProgressBarDemo.java (in a .java source file)
   LongTask.java (in a .java source file)
   SwingWorker.java (in a .java source file)
  How to Monitor Progress
ProgressMonitorDemo.java (in a .java source file)
   LongTask.java (in a .java source file)
   SwingWorker.java (in a .java source file)
  How to Monitor Progress
RadioButtonDemo.java (in a .java source file) Bird.gif, Cat.gif, Dog.gif, Rabbit.gif, Pig.gif How to Use Buttons, ...
ScrollDemo.java (in a .java source file)
   Rule.java (in a .java source file)
   Corner.java (in a .java source file)
   ScrollablePicture.java (in a .java source file)
youngdad.jpeg How to Use Scroll Panes
ScrollDemo2.java (in a .java source file)   How to Use Scroll Panes
SharedModelDemo.java (in a .java source file)   Nowhere
SimpleTableDemo.java (in a .java source file)   How to Use Tables
SimpleTableSelectionDemo.java (in a .java source file)   How to Use Tables
SliderDemo.java (in a .java source file) All of the images in the images/doggy directory. How to Use Sliders
SliderDemo2.java (in a .java source file) All of the images in the images/doggy directory. How to Use Sliders
SplitPaneDemo.java (in a .java source file) imagenames.properties and all of the image files listed in it. How to Use Split Panes
SplitPaneDemo2.java (in a .java source file) imagenames.properties and all of the image files listed in it. How to Use Split Panes
TabbedPaneDemo.java (in a .java source file) middle.gif How to Use Tabbed Panes
TableDemo.java (in a .java source file)   How to Use Tables
TableEditDemo.java (in a .java source file)
   WholeNumberField.java (in a .java source file)
  How to Use Tables
TableDialogEditDemo.java (in a .java source file)
   WholeNumberField.java (in a .java source file)
  How to Use Tables
TableRenderDemo.java (in a .java source file)   How to Use Tables
TableSorterDemo.java (in a .java source file)
   TableMap.java (in a .java source file)
   TableSorter.java (in a .java source file)
  How to Use Tables
TextComponentDemo.java (in a .java source file)
   LimitedStyledDocument.java (in a .java source file)
  General Rules for Using Text Components
TextDemo.java (in a .java source file) (an applet)   How to Use Text Fields
TextFieldDemo.java (in a .java source file)
   DecimalField.java (in a .java source file)
   FormattedDocument.java (in a .java source file)
   WholeNumberField.java (in a .java source file)
  How to Use Text Fields
TextSamplerDemo.java (in a .java source file) Pig.gif, sound.gif, dukeWaveRed.gif, TextSamplerDemoHelp.html Using Text Components
ToolBarDemo.java (in a .java source file) right.gif, middle.gif, left.gif How to Use Tool Bars
ToolBarDemo2.java (in a .java source file) right.gif, middle.gif, left.gif How to Use Tool Bars
TopLevelDemo.java (in a .java source file)   Using Top-Level Containers
TreeDemo.java (in a .java source file) Several html files. How to Use Trees
TreeIconDemo.java (in a .java source file) middle.gif and several html files. How to Use Trees
TreeIconDemo2.java (in a .java source file) middle.gif and several html files. How to Use Trees
TumbleItem.java (in a .java source file) (an applet)
   SwingWorker.java (in a .java source file)
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

Previous Page Lesson Contents Next Page Start of Tutorial > Start of Trail > Start of Lesson Search
Feedback Form

Copyright 1995-2005 Sun Microsystems, Inc. All rights reserved.