Chapter 2. Learning Swing by Example

 <  Day Day Up  >  

http://java.sun.com/docs/books/tutorial/uiswing/learn/index.html

This chapter explains the concepts you need to use Swing components in building a user interface. First we examine the simplest Swing application you can write. Then we present several progressively complicated examples of creating user interfaces using components in the javax.swing package. We cover several Swing components, such as buttons , labels, and text areas. The handling of events is also discussed, as are layout management and accessibility.

Most of the topics this chapter discusses are covered in depth in later chapters ”for example, you can get detailed information on how to use components from Chapter 7, Components Reference ”but this chapter gives you the grand tour. This chapter ends with a set of questions and exercises so you can test yourself on what you've learned.

Example One: Your First Swing Program

Example Two: SwingApplication

Look and Feel

Setting up Buttons and Labels

Adding Components to Containers

Adding Borders around Components

Handling Events

Example Three: CelsiusConverter

Example Four: An Improved CelsiusConverter

Adding HTML

Adding an Icon

Setting the Default Button

Creating a Formatted Text Field

Example Five: LunarPhases

Using Layout Managers

Compound Borders

Combo Boxes

Handling Events on a Combo Box

Multiple Images

Example Six: VoteDialog

Radio Buttons

Dialogs

Summary

Questions and Exercises

Example Programs

 <  Day Day Up  >  


JFC Swing Tutorial, The. A Guide to Constructing GUIs
The JFC Swing Tutorial: A Guide to Constructing GUIs (2nd Edition)
ISBN: 0201914670
EAN: 2147483647
Year: 2004
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net