Specifications

Sun Services
Java™ Programming Language
xiii
Copyright 2005 Sun Microsystems, Inc. All Rights Reserved. Sun Services, Revision F
How to Create a Menu ......................................................................................................................... 12-9
Creating a MenuBar ............................................................................................................................. 12-10
Creating a Menu ................................................................................................................................... 12-11
Creating a MenuItem ........................................................................................................................... 12-13
Creating a CheckBoxMenuItem ......................................................................................................... 12-15
Controlling Visual Aspects ................................................................................................................ 12-17
J.F.C./Swing Technology ................................................................................................................... 12-18
Threads ................................................................................................................... 13-1
Objectives ............................................................................................................................................... 13-2
Relevance ................................................................................................................................................ 13-3
Threads ................................................................................................................................................... 13-4
Creating the Thread .............................................................................................................................. 13-5
Starting the Thread ............................................................................................................................... 13-7
Thread Scheduling ................................................................................................................................ 13-8
Thread Scheduling Example ............................................................................................................... 13-9
Terminating a Thread ......................................................................................................................... 13-10
Basic Control of Threads .................................................................................................................... 13-12
The join Method ................................................................................................................................ 13-13
Other Ways to Create Threads .......................................................................................................... 13-14
Selecting a Way to Create Threads ................................................................................................... 13-15
Using the synchronized Keyword ................................................................................................. 13-16
The Object Lock Flag .......................................................................................................................... 13-17
Releasing the Lock Flag ...................................................................................................................... 13-20
Using synchronized – Putting It Together .................................................................................... 13-21
Thread State Diagram With Synchronization ................................................................................. 13-23
Deadlock ............................................................................................................................................... 13-24
Thread Interaction – wait and notify ............................................................................................ 13-25
Thread Interaction ............................................................................................................................... 13-26
Thread State Diagram With wait and notify .............................................................................. 13-27