12.12. Chapter Summary

 
[Page 397]
The Goddess Chalchihuitlicue, found in the Valley of Mexico, 1300-1500 AD (stone), Aztec / Muse de l'Homme, Paris, France / Bridgeman Art Library

Part 1, "Fundamentals of Programming," introduced basic programming concepts that are supported in all programming languages. Part 2, "Object-Oriented Programming," introduced object-oriented programming concepts, principles, and practices that are common in the object-oriented programming languages. Java is not simply a programming language. It is also a development and deployment platform with an extensive set of classes and interfaces in the API. You have to use the classes and interfaces in the API and follow their conventions and rules to develop your own projects. The design of the API for Java GUI programming is an excellent example of how the object-oriented principle is applied. In the chapters that follow, you will learn the framework of Java GUI API and use the GUI components to develop user -friendly interfaces for applications and applets.


[Page 398]

Prerequisites for Part 3

Part 3, "GUI Programming," may be intertwined with Part 2, "Object-Oriented Programming." You can cover GUI programming in Chapters 12 and 13, "Getting Started with GUI Programming" and "Graphics," after you have covered abstract classes in Chapter 10, "Abstract Classes and Interfaces."

Interfaces in Chapter 10, "Abstract Classes and Interfaces," can be covered just before Chapter 14, " Event-Driven Programming ."

The concept and simple examples of using applets can be covered earlier after Chapter 12, "GUI Basics."


 

Chapter 12 Getting Started with GUI Programming

 

Chapter 13 Graphics

 

Chapter 14 Event-Driven Programming

 

Chapter 15 Creating User Interfaces

 

Chapter 16 Applets and Multimedia

[Page 399]

Chapter 12. Getting Started with GUI Programming

Mayan God Shel, Mexico. Photographer: Philip Coblentz. Courtesy Brand X Pictures

Objectives

  • To get a glimpse of simple GUI components (12.2).

  • To describe the Java GUI API hierarchy (12.3).

  • To create user interfaces using frames , panels, and simple GUI components (12.4).

  • To understand the role of layout managers (12.5).

  • To use the FlowLayout , GridLayout , and BorderLayout managers to layout components in a container (12.5).

  • To specify colors and fonts using the Color and Font classes (12.612.7).

  • To use JPanel as subcontainers (12.8).

  • To apply common features such as borders, tool tips, fonts, and colors on Swing components (12.9).

  • To use borders to visually group user-interface components (12.9).

  • To create image icons using the ImageIcon class (12.10).


[Page 400]

12.1. Introduction

Until now, you have only used dialog boxes and the command window for input and output. You used JOptionPane.showInputDialog to obtain input, and JOptionPane.showMessageDialog and System.out.println to display results. These approaches have limitations and are inconvenient. For example, to read ten numbers , you have to open ten input dialog boxes. Starting with this chapter, you will learn Java GUI programming. You will create custom graphical user interfaces (GUI, pronounced goo-ee ) to obtain input and display output in the same user interface.

This chapter introduces the basics of Java GUI programming. Specifically, it discusses GUI components and their relationships, containers and layout managers, colors, fonts, borders, and tool tips.

 


Introduction to Java Programming-Comprehensive Version
Introduction to Java Programming-Comprehensive Version (6th Edition)
ISBN: B000ONFLUM
EAN: N/A
Year: 2004
Pages: 503

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