Académique Documents
Professionnel Documents
Culture Documents
D16390GC20
Edition 2.0
June 2003
D38327
Authors
Jeff Gallus
Glenn Stokol
Technical Contributors
and Reviewers
Anna Atkinson
William Bates
Kenneth Cooper
Craig Cummings
Michael Curtis
Patrice Daux
Mangesh Koli
Glenn Maslen
Monica Motley
Dan Pillay
Blaise Ribet
Gary Williams
Publisher
Sujatha Nagendra
Contents
Preface
Introduction
Objectives I-2
Course Overview I-3
Java Developer Courses I-4
1
iii
iv
vi
vii
viii
ix
Summary 13-21
Practice 13 Overview 13-2
14 User Interface Design: Swing Basics Planning the Application Layout
Objectives 14-2
Running Java UI Applications 14-3
AWT, Swing, and JFC 14-4
Swing Features 14-6
Lightweight or Heavyweight Components? 14-8
Planning the UI Layout 14-9
The Containment Hierarchy 14-10
Top-Level Containers 14-12
Intermediate Containers 14-14
Atomic Components 14-15
Layout Management Overview 14-16
Border Layout 14-18
GridBag Layout 14-19
GridBag Constraints 14-20
Using Layout Managers 14-22
Combining Layout Managers 14-24
Using Frames or Dialogs 14-25
Using JPanel Containers 14-27
Adding Borders to Components 14-29
Using Internal Frames 14-30
Swing Text Controls 14-32
Adding Components with Oracle9i JDeveloper 14-33
Creating a Frame 14-34
Adding Components 14-35
Setting Pluggable Look and Feel 14-37
Summary 14-39
Practice 14 Overview 14-40
15 Adding User Interface Components and Event Handling
Objectives 15-2
Swing Components 15-3
Swing Components in JDeveloper 15-5
Invoking the UI Editor 15-7
How to Add a Component to a Form 15-8
Edit the Properties of a Component 15-9
Code Generated by JDeveloper 15-10
Creating a Menu 15-12
xi
xii
4. Install the JavaBean in JDevelopers Component Palette, via Its Library Name
16-20
5. Develop an Application Using the JavaBean 16-21
Summary 16-22
Practice 16 Overview 16-23
17 Using JDBC to Access the Database
Objectives 17-2
Java, J2EE, and Oracle9i 17-3
Connecting to a Database with Java 17-4
What Is JDBC? 17-5
Preparing the Environment 17-6
Steps for Using JDBC to Execute SQL Statements 17-8
Step 1: Registering the Driver 17-9
Connecting to the Database 17-10
Oracle JDBC Drivers: Thin Client Driver 17-11
Oracle JDBC Drivers: OCI Client Drivers 17-12
Choosing the Right Driver 17-13
Step 2: Getting a Database Connection 17-14
About JDBC URLs 17-15
JDBC URLs with Oracle Drivers 17-16
Step 3: Creating a Statement 17-17
Step 4: Executing SQL Statements 17-18
Using the Statement Interface 17-19
Step 4a: Executing a Query 17-20
The ResultSet Object 17-21
4b: Submitting DML Statements 17-22
4b: Submitting DDL Statements 17-23
Step 5: Processing the Query Results 17-24
A Basic Query Example 17-25
Step 6: Closing Connections 17-26
Mapping Database Types to Java Types 17-27
Handling an Unknown SQL Statement 17-29
Handling Exceptions 17-30
Managing Transactions 17-31
The PreparedStatement Object 17-32
How to Create a PreparedStatement 17-33
How to Execute a PreparedStatement 17-34
Maximize Database Access 17-35
Connection Pooling 17-36
Summary 17-39
Practice 17 Overview 17-40
xiii
xiv