Chapter 7:Advanced AWT 549
7.1 The Rendering Pipeline 550
7.2 Shapes 553
7.2.1 Using the Shape Classes 555
7.3 Areas 570
7.4 Strokes 572
7.5 Paint 581
7.6 Coordinate Transformations 583
7.7 Clipping 589
7.8 Transparency and Composition 592
7.9 Rendering Hints 601
7.10 Readers and Writers for Images 608
7.10.1 Obtaining Readers and Writers for Image File Types 608
7.10.2 Reading and Writing Files with Multiple Images 610
7.11 Image Manipulation 619
7.11.1 Constructing Raster Images 619
7.11.2 Filtering Images 626
7.12 Printing 636
7.12.1 Graphics Printing 637
7.12.2 Multiple-Page Printing 647
7.12.3 Print Preview 649
7.12.4 Print Services 659
7.12.5 Stream Print Services 664
7.12.6 Printing Attributes 664
7.13 The Clipboard 672
7.13.1 Classes and Interfaces for Data Transfer 674
7.13.2 Transferring Text 674
7.13.3 The Transferable Interface and Data Flavors 678
7.13.4 Building an Image Transferable 680
7.13.5 Transferring Java Objects via the System Clipboard 685
7.13.6 Using a Local Clipboard to Transfer Object References 689
7.14 Drag and Drop 689
7.14.1 Data Transfer Support in Swing 691
7.14.2 Drag Sources 696
7.14.3 Drop Targets 699
7.15 Platform Integration 707
7.15.1 Splash Screens 708
7.15.2 Launching Desktop Applications 713
7.15.3 The System Tray 719
Chapter 8:JavaBeans Components 725
8.1 Why Beans? 726
8.2 The Bean-Writing Process 728
8.3 Using Beans to Build an Application 731
8.3.1 Packaging Beans in JAR Files 731
8.3.2 Composing Beans in a Builder Environment 733
8.4 Naming Patterns for Bean Properties and Events 740
8.5 Bean Property Types 743
8.5.1 Simple Properties 744
8.5.2 Indexed Properties 744
8.5.3 Bound Properties 745
8.5.4 Constrained Properties 746
8.6 BeanInfo Classes 754
8.7 Property Editors 758
8.7.1 Writing Property Editors 762
8.7.1.1 String-Based Property Editors 762
8.7.1.2 GUI-Based Property Editors 765
8.8 Customizers 770
8.8.1 Writing a Customizer Class 772
8.9 JavaBeans Persistence 779
8.9.1 Using JavaBeans Persistence for Arbitrary Data 784
8.9.1.1 Writing a Persistence Delegate to Construct an Object 784
8.9.1.2 Constructing an Object from Properties 786
8.9.1.3 Constructing an Object with a Factory Method 787
8.9.1.4 Postconstruction Work 787
8.9.1.5 Transient Properties 788
8.9.2 A Complete Example for JavaBeans Persistence 791
Chapter 9:Security 803
9.1 Class Loaders 804
9.1.1 The Class Loader Hierarchy 806
9.1.2 Using Class Loaders as Namespaces 808
9.1.3 Writing Your Own Class Loader 808
9.2 Bytecode Verification 816
9.3 Security Managers and Permissions 821
9.3.1 Java Platform Security 822
9.3.2 Security Policy Files 826
9.3.3 Custom Permissions 834
9.3.4 Implementation of a Permission Class 835
9.4 User Authentication 842
9.4.1 JAAS Login Modules 849
9.5 Digital Signatures 858
9.5.1 Message Digests 859
9.5.2 Message Signing 862
9.5.3 Verifying a Signature 865
9.5.4 The Authentication Problem 868
9.5.5 Certificate Signing 870
9.5.6 Certificate Requests 872
9.6 Code Signing 873
9.6.1 JAR File Signing 873
9.6.2 Software Developer Certificates 878
9.7 Encryption 880
9.7.1 Symmetric Ciphers 881
9.7.2 Key Generation 882
9.7.3 Cipher Streams 887
9.7.4 Public Key Ciphers 888
Chapter 10:Scripting,Compiling,and Annotation Processing 893
10.1 Scripting for the Java Platform 894
10.1.1 Getting a Scripting Engine 894
10.1.2 Script Evaluation and Bindings 895
10.1.3 Redirecting Input and Output 898
10.1.4 Calling Scripting Functions and Methods 899
10.1.5 Compiling a Script 901
10.1.6 An Example:Scripting GUI Events 901
10.2 The Compiler API 907
10.2.1 Compiling the Easy Way 907
10.2.2 Using Compilation Tasks 907
10.2.3 An Example:Dynamic Java Code Generation 913
10.3 Using Annotations 919
10.3.1 An Example:Annotating Event Handlers 920
10.4 Annotation Syntax 926
10.5 Standard Annotations 931
10.5.1 Annotations for Compilation 932
10.5.2 Annotations for Managing Resources 932
10.5.3 Meta-Annotations 933
10.6 Source-Level Annotation Processing 935
10.7 Bytecode Engineering 943
10.7.1 Modifying Bytecodes at Load Time 949
Chapter 11:Distributed Objects 953
11.1 The Roles of Client and Server 954
11.2 Remote Method Calls 957
11.2.1 Stubs and Parameter Marshalling 957
11.3 The RMI Programming Model 959
11.3.1 Interfaces and Implementations 959
11.3.2 The RMI Registry 961
11.3.3 Deploying the Program 965
11.3.4 Logging RMI Activity 968
11.4 Parameters and Return Values in Remote Methods 970
11.4.1 Transferring Remote Objects 971
11.4.2 Transferring Nonremote Objects 971
11.4.3 Dynamic Class Loading 974
11.4.4 Remote References with Multiple Interfaces 979
11.4.5 Remote Objects and the equals,hashCode,and clone Methods 980
11.5 Remote Object Activation 980
Chapter 12:Native Methods 989
12.1 Calling a C Function from a Java Program 990
12.2 Numeric Parameters and Return Values 997
12.2.1 Using printf for Formatting Numbers 997
12.3 String Parameters 999
12.4 Accessing Fields 1005
12.4.1 Accessing Instance Fields 1005
12.4.2 Accessing Static Fields 1009
12.5 Encoding Signatures 1010
12.6 Calling Java Methods 1012
12.6.1 Instance Methods 1012
12.6.2 Static Methods 1016
12.6.3 Constructors 1017
12.6.4 Alternative Method Invocations 1018
12.7 Accessing Array Elements 1019
12.8 Handling Errors 1023
12.9 Using the Invocation API 1028
12.10 A Complete Example:Accessing the Windows Registry 1034
12.10.1 Overview of the Windows Registry 1034
12.10.2 A Java Platform Interface for Accessing the Registry 1036
12.10.3 Implementation of Registry Access Functions as Native Methods 1036
Index 1051