16. Applets and Multimedia

 
[Page 491]

Chapter 15. Creating User Interfaces

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

Objectives

  • To create graphical user interfaces with various user-interface components : JButton , JCheckBox , JRadioButton , JLabel , JTextField , JTextArea , JComboBox , JList , JScrollBar , and JSlider ( § §15.2 “15.11).

  • To create listeners for various types of events ( § §15.2 “15.11).

  • To display multiple windows in an application ( §15.12).


[Page 492]

15.1. Introduction

A graphical user interface ( GUI ) makes a system user-friendly and easy to use. Creating a GUI requires creativity and knowledge of how GUI components work. Since the GUI components in Java are very flexible and versatile, you can create a wide assortment of useful user interfaces.

Many Java IDEs provide tools for visually designing and developing GUI interfaces. This enables you to rapidly assemble the elements of a user interface (UI) for a Java application or applet with minimum coding. Tools, however, cannot do everything. You have to modify the programs they produce. Consequently, before you begin to use the visual tools, it is imperative that you understand the basic concepts of Java GUI programming.

Previous chapters briefly introduced several GUI components. This chapter introduces the frequently used GUI components in detail (see Figure 15.1).

Figure 15.1. These Swing GUI components are frequently used to create user interfaces.

Note

Throughout this book, the prefixes jbt , jchk , jrb , jlbl , jtf , jpf , jta , jcbo , jlst , jscb , and jsld are used to name reference variables for JButton , JCheckBox , JRadioButton , JLabel , JTextField , JPasswordField , JTextArea , JComboBox , JList , JScrollBar , and JSlider .


 


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