Home : Course Map : Chapter 6 : Java :
Introduction to Java Graphics
JavaTech
Course Map
Chapter 6

Introduction
AWT
Swing
Containers
  Demo 1
UI Components
  Demo 2
UI Layout
  Demo 3   Demo 4
Text Display
  Demo 5
Drawing
  Demo 6   Demo 7
Draw Polygons
  Demo 8   Demo 9
Colors
Text Draw 
  Demo 10
Images
  Demo 11
Exercises

    Supplements
AWT
  Demo 1
Drawing
  Demo 2
Text Drawing
  Demo 3
UI Components
  Demo 4

Java2D
Shapes & Areas
  Demo 1   Demo 2
Stroke & Paint
  Demo 3
Transforms
  Demo 4
Gradients&Textures
  Demo 5   Demo 6
Text
  Demo 7   Demo 8
     About JavaTech
     Codes List
     Exercises
     Feedback
     References
     Resources
     Tips
     Topic Index
     Course Guide
     What's New
TextFieldsTextAreas.java
(Uses techniques discussed in this and following chapters)

 

An essential and very popular part of Java has always been its graphical user interface (GUI) capabilities. The above applet, for example, illustrates some of the basic aspects of a GUI program. The display shows a large panel area that holds various components. These components include buttons for control, text fields for inputs, and a text area for output.

From version 1.0 the standard JVM included the java.awt package and sub-packages that provided the classes to develop user interfaces and to do drawing. However, the original graphics capabilities in Java 1.0 and 1.1 were quite limited. This led to some disenchantment with Java for standalone client applications.

With version 1.2 came the addition of the so-called Swing packages that greatly expanded the range and flexibility of Java GUI design. Swing components include tables, buttons with icons, radio buttons, and more. (Sun's Visual Index to the Swing Components shows whats available.)

In this chapter we give an introduction to the basics of programming a user interface and discuss both the AWT and Swing. The sections include :

  • AWT discusses the basic level GUI class hierarchy in Java and its limitations.
  • Swing gives an overview of the Swing classhierarchy.
  • Containers are components that hold other components. A GUI program always includes at least one top level container and usually several sub-containers.
  • Components discusses basic GUI development.
  • Text display with components like JTextField and JTextArea.
  • Simple Drawing discusses how to use a panel component as a drawing board.
  • Drawing Polygons - illustrates techniques taken to much higher level by Java2D.
  • Drawing Text - how to display text on a drawing panel
  • Images - basics of reading in an image file and displaying it on a panel.
  • Exercises

The Chapter 6: Supplement section provides more examples of a purely AWT component approach to GUI design and the Java2D graphics package.

 

            Tech
Java Tech Graphics
Starting to Plot
  Demo 1
Drawing Panel
  Demo 2
Histogram Display

  Demo 3
Exercises

           Physics
Display Text Data
  Demo 1
Plot Data
  Demo 2
Find Max/Min
  Demo 3
Exercises

  
  Part I Part II Part III
Java Core 1  2  3  4  5  6  7  8  9  10  11  12 13 14 15 16 17
18 19 20
21
22 23 24
Supplements

1  2  3  4  5  6  7  8  9  10  11  12

Tech 1  2  3  4  5  6  7  8  9  10  11  12
Physics 1  2  3  4  5  6  7  8  9  10  11  12

Java is a trademark of Sun Microsystems, Inc.