Course Notes Table Of Contents
Overview
Course Notes
1. Introduction
Agenda - Day One
Java Can Help!
Portability
Portability: Java Language
Portability: Java Library
Portability: Java Byte Code
Security
Security (continued)
Robustness
Distributed Applications
Online Demos on WWW
Porting Strategies
Complete Rewrite to 100% Java
Native-Code Interface
Client/Server using Sockets
Third-Party Portability
2. Introduction to VisualAge for Java
3. AWT Review
AWT Review
AWT Concepts
AWT Component Hierarchy
Component
Container
Button
Canvas
Checkbox
CheckboxGroup
Choice
Label
List
ScrollBar
TextComponent
TextArea
Panel
Applet
ScollPane
Window
Frame
Dialog
FileDialog
Menus
Menu Components
Menu Components (continued)
Layout Managers
Layout Managers (continued)
AWT-Provided Layout Managers
AWT-Provided Layout Managers (continued)
But None of the Layout Managers Solve my Problem!
FlowLayout
BorderLayout
CardLayout
GridLayout
GridBagLayout
Interface Layout Design
Layout Manager Design Considerations
Layout Manager Design Considerations (continued)
About CardLayout
About BorderLayout
About BorderLayout (continued)
About FlowLayout
About GridLayout
About GridBagLayout
Custom Layout Managers
4. Comparison of OS/2 and Java GUI Components
Agenda -- Day Two
OS/2 Controls vs. AWT Components
Push Button
Check Box
Radio Button
ComboBox
Container
EntryField
Frame
ListBox
Menu
MultipleLineEntryField
Notebook
ScrollBar
Slider
SpinButton
Static
TitleBar
ValueSet
An Example of Interface Design
An Example of Interface Design
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Example (continued)
Another Example
5. Events in OS/2 and Java
Event-Driven Programming
OS/2 Messages
Java Events
Old-Style Events
Delegation-Model Events
VisualAge Event Setup
Property-to-Property Connections
Event-to-Property Connections
Event-to-Method Connections
Event-to-Script Connections
Property-to-Method Connections
Parameter Connections
Constant Parameters
Multiple Connections
Editing the VisualAge-Generated Code
Editing the VisualAge-Generated Code (continued)
A Few Tricks
Factoring Connections
Tear-Off Properties
Casting Properties
6. File Input and Output
Agenda -- Day Three
OS/2 File I/O
OS/2 File I/O APIs
DosOpen / DosClose
DosRead / DosWrite
DosResetBuffer / DosDevIOCtl / DosSetFileInfo
DosSetFilePtr / DosDupHandle
Java File I/O
Java File I/O Issues
Predefined System I/O Objects
File Objects
File Objects (example)
Writing Output
FilterOutputStream
FileOutputStream
DataOutputStream
PrintStream
BufferedOutputStream
Reading Input
FileInputStream
DataInputStream
StringBufferInputStream
Random Access I/O
Reading From URLs
Client/Server Introduction
Client/Server Visualization
What's a Socket?
Creating Servers
Creating Clients
What to Do Upon Connection?
Multiple Clients
7. Threads
Threads
Thread Introduction
OS/2 Threads and Semaphores
DosCreateThread
DosSuspendThread / DosResumeThread
DosWaitThread / DosKillThread / DosExit
Additional APIs
Semaphores
Event Semaphores
Event Semaphore APIs
Mutex Semaphores
Mutex Semaphore APIs
MuxWait Semaphores
MuxWait Semaphore APIs
Java Threads
Spawning a Thread
Spawning a Thread Continued...
Thread Example
Thread Example Continued...
Thread Control
Problems With Threads
Thread Safety: Terminology
Thread Safety and Java
Synchronization Example
Synchronization Example (continued)
Synchronization Example (continued)
Solution 1
Solution 2
Synchronized Statements
Per-Class Synchronization
Per-Class Synchronization Cont'd...
Condition Synchronization
Condition Synchronization Cont'd...
Blocking Queue
Thread Liveness
Deadlock
Deadlock Example
Thread Starvation
Ensuring Safety and Liveness
Converting OS/2 to Java
Thread Manipulation
Thread Manipulation (continued)
Thread Manipulation (continued)
Semaphores
8. A Complete Porting Example
Reference Sections
A1. Making the Transition from OS/2 to Java
Colored panes
Compass Points
Drawing a Stick Figure
Phone dialing keypad
Absolute Layout
Color List
Display a file from a File Dialog
Double-buffering
Menus
A2. Object-Oriented Basics
Preview
Isn't OO Something New?
Isn't Procedural More Efficient?
Isn't OO Hard?
Isn't Code Reuse the Most Important Thing to OO People?
A Procedural Programmer Actually Invented Object-Oriented Programming
Shifting the Paradigm from Structured to Object-Oriented
What's an Object?
State and Behavior
The 2 Parts of an Object
Hiding Data
What Does Object-Oriented Mean?
Class and Instance
Defining by Difference
Inheritance, Overriding and Refining
Types of Inheritance
Messages and Methods
Interface and Implementation
Dynamic Binding
The Class is Also an Object
Protocols
Garbage Collection
Language and Library
Libraries Expand a Programmer's Range
OO Benefits
Downsides
Terms and Examples
Review
Java
A3. Java Basics
Portability
Security
Robustness
Java Program Structure
Java Program Execution
A Simple Application
Applet Execution
A Simple Applet
HTML/Applet Interface
Comments
Declarations
Primitive Types
Objects
Strings
Array Objects
Initializers
Constants
Expressions
Operators
Statements
Java Semantics
Assignment of Objects
Method Parameters and Return Values
Equality
No Pointers!
Garbage Collection
A4. The Java Object Model and Exceptions
Classes
Method Definitions
Constructor Syntax
Order of Initialization and Constructor Calls
Variable Definitions
Class Inheritance
Access Rights to Class Members
Classes Are "Conscious"
Abstract Classes
The Relationship between C Structures and Java Classes
A Java Implementation
Using the List Managers
Are Classes Only For Object-Oriented Programming?
Packages
Package Hierarchy and Directory Hierarchy
Interfaces
Objects Implement Roles
Interface Example 1
Interface Example 2
Interface Example 3
Interface Benefits
Interface Implementation Versus Class Inheritance
Dynamic Messages
Benefits of Dynamic Messages
Dynamic Loading
Benefits of Dynamic Loading
Introduction to Java Exceptions
Common Exceptions
Uncaught Exceptions
Finally Block
Runtime vs. Non-Runtime
Defining Your Own Exceptions
A5. AWT Basics
Graphical User Interfaces
AWT Introduction
AWT Concepts
Components
Buttons
Canvas
Checkbox
CheckboxGroup
Choice
Label
List
Scrollbar
TextField
TextArea
Mapping Java Components to the Openclass Library
Platform Specific Information
Graphics Primitives
Lines
Rectangles
Arcs
Polygons
Painting
Drawing Text
Colors
Fonts
Font Metrics
System Colors
Containers
Insets
Adding Components to a Container
Layout Managers
ScrollPane
A6. AWT Programming
Events 1.0 Style
Event Flow
Event Handler Return Values
Convenience Functions
Action Events
The Event Class
Events 1.1 Style
AWTEvent
Low-level Events
Semantic Events
Event Sources
Event Listeners
Event Adapters
Button Pressing Example
Adapters Example
GUI-Based Applications
Applications: Dialog Boxes
Applications: File Dialog Boxes
Applications: Menus
Menu Shortcuts
Popup Menus
A7. Threads
Introduction
Spawning a Thread
Controlling Thread Execution
Thread Safety
Monitors
Mutual Exclusion
Condition Synchronization
Thread Liveness
Deadlock
Ensuring Safety and Liveness
Restricted Universes
"Red Flags" And Hints
Further Reading and References
A8. The Java File I/O Classes
Introduction
Predefined System I/O Objects
File Objects
Writing Output
What is class
FilterOutputStream
for?
FileOutputStream/FileWriter
DataOutputStream
PrintStream/PrintWriter
BufferedOutputStream
Reading Input
FileInputStream/FileReader
DataInputStream
StringBufferInputStream
Random Access I/O
Reading From Remote File Systems
Copyright © 1996-1997
MageLang Institute
. All Rights Reserved.