Java Programming II
by Willis L. Boughton
Trade paperback: 346 pages
ISBN: 1-59399-134-7
Our price: 43.50
Availability: in stock/ready to ship
To buy a copy: Click here to register and buy
For bulk orders: Call (800) 218-5971, option 5
Book ID: 10633-1-1
Java Programming II About This Book

The goal of this book and its companion Java Programming I is to give you skills required by a Java programmer in industry. These books focus on Java fundamentals and real-world skills, not computer science theory. This book continues Java Programming I and covers Java features commonly used in business applications, including threads, collections, networking, Remote Method Invocation, JDBC, advanced Swing, JAR files, JavaBeans, applets, servlets, and XML. This book presumes you are proficient with the topics covered in Java Programming I.

About the author

Willis L. Boughton has a B.S. in physics from Kansas State University and a Ph.D. in astronomy from the University of Illinois at Urbana. He has twenty years of industry experience as a system analyst and software development manager in medical imaging, real-time embedded systems, and statistical process control. His last industry position was Director of Process Measurements for Ameritech Corporate Information Services. He now is on the faculty of the Computer Information Systems Department at William Rainey Harper College in Palatine, IL.

Willis L. Boughton


Table of Contents

1. Threads

1

Thread Concepts

3

Multitasking and Multithreading

3

Thread Objects and States

4

Thread Lifetime

5

Thread Message

5

Selfish and Unselfish Threads

5

Thread Behavior

7

Basic Thread Operations

8

Creating a Thread

9

Starting a Thread

11

Ending a Thread

11

Thread Priorities

14

Thread Groups

15

Thread Synchronization

16

Synchronized Messages

17

Object Locks

20

wait and notify All Messages

21

Deadlocks

25

Threads and Swing

26

Event Queue Class

29

Timer Class

32

Swing Thread Rules Summary

34

2. Collections

35

Collection Types and Iterators

35

Collection Interfaces

36

Collection versus Map

40

Iterators

41

List Iterators

43

Sorting

44

Comparable Interface

45

Comparator Interface

45

SortedSet Interface

46

SortedMap Interface

47

Collection Classes

48

Person Class used in Examples

48

LinkedList Class

49

HashSet Class

52

TreeSet Class

55

Map Classes

58

HashMap Class

58

TreeMap Class

60

Properties Class

64

Map Views

65

Synchronized Views

67

Unmodifiable Views

68

Collection Characteristics Summary

68

3. Networking

70

TCP/IP Networking Basics

70

Protocols and Protocol Stacks

70

Addresses

72

Sockets

74

Java TCP/IP

75

InetAddress Class

75

ServerSocket and Socket Classes

77

Threaded Servers

82

HTTP Server

88

Client/Server Protocols

92

Uniform Resource Locators

99

URL Classes

100

4. Remote Method Invocation

104

RMI Concepts

105

Relationship between RMI and Client/Server

105

Remote Interfaces and Remote Classes

106

Passing of Message Parameters and Returns for Local Objects

107

Passing of Message Parameters and Returns for Remote Objects

107

Stub Object

108

Getting a Stub Object

109

RMI Requirements Summary

111

Example RMI Application

111

RandomASCIIString Class

112

Local Object Program

113

Steps for Implementing Remote Objects

114

Define the Remote Interface

114

Define the Remote Object Class

114

Generate the Stub Class

115

Define the RMI Remote Program Class

115

Define the RMI Local Program Class

117

Running the RMI Application

117

Deploying RMI Applications

118

Stub Class Available Locally

118

Stub Class Not Available Locally

119

5. Java Database Connectivity

123

Database Terminology

124

Structured Query Language

124

SQL Data Types

125

SQL Statement

126

Executing SQL

127

Loading the JDBC Driver

127

Connecting to the Database

128

Executing Statements

129

DBMS used for Examples

130

Basic JDBC Program

131

Queries

133

ResultSet

133

Transactions

138

Application OO Design

140

6. Advanced Swing

145

Swing Architecture

145

UI Manager Class

145

UI Delegate Object

146

Model Object

146

Swing Architecture Advantages

146

Tree Basics

147

Tree Nodes

148

JTree Class

153

Tree Model

154

JTree Methods

156

Custom Tree Models

160

Cell Rendering

164

JTree Event

169

Tree Editing

173

JTable Class

175

Table Model

175

JTable Procedure

176

JTable API

178

Table Cell Selection

180

Displaying Database Records

181

Table Cell Rendering

190

Table Cell Editing

193

Table Row Sorting

198

Dynamic Table Models

200

7. Java Archives and Javadoc

203

Java Archives

203

JAR Functions and Components

203

JAR Organization and the classpath

204

Jar Tool

206

Package Example

207

Resources in JARs

208

Javadoc Documentation

210

Markup

210

Running javadoc

211

8. JavaBeans

214

Background

214

Properties

215

Starting to Work with Beans

217

RandomASCIIString Bean, Version 1

218

Making a Bean JAR

221

Using a Bean in an IDE

221

Advanced Properties and Custom Events

222

Bound 223 Constrained Properties

228

Custom E234 Beans and Threads

235

Custom Events in an IDE

241

BeanInfo

242

BeanInfo AP

243

Writing a BeanInfo

245

Property Editors

252

Text 254

254

GUI Property Editor

256

Customizers

256

9. Applets

258

Applet Basics

258

JApplet Class

258

Applet HTM

260

Executing an Applet

261

TimeTicker Applet

262

Applet Security

264

Applets in Three-Tier Architecture

265

Two-Tier and Three-Tier Architectures

265

Three-Tier Applet

266

10. Servlets

271

Servlet Basics

271

Servlet engine

272

HTTP protocol

273

Servlet HTML

274

Browser caching

279

Servlet Development

279

Servlet API

279

Servlet development procedure

283

Servlets and Websites

287

Using Multiple Servlets

287

Handling Multiple Clients

291

Cookies

291

Sessions

296

11. Extensible Markup Language

300

XML Basics

301

XML Document Structure

301

Document Type Definition

302

Viewing an XML document

305

Parsing an XML document

305

DOM Parser API

306

DOM Parser Use

309

Writing an XML document

319

Appendix A. Abbreviations

322

Appendix B. OO Summary

323

Appendix C. Java summary

325

Appendix D. Exercise Answers

329

Back to top | OriginalWorks