0%

Book Description

The Java AWT Reference provides complete reference documentation on the Abstract Window Toolkit (AWT), a large collection of classes for building graphical user interfaces in Java. With AWT, you can create windows, draw, work with images, and use components like buttons, scrollbars, and pulldown menus. The Java AWT Reference covers the classes that comprise the java.awt, java.awt.image, java.applet,java.awt.event, and java.awt.datatransfer packages. These classes provide the functionality that allows a Java application to provide user interaction in a graphical environment.This book takes you beyond what you'd expect from a standard reference manual. Classes and methods are, of course, described in detail. But the book does much more. It offers a comprehensive explanation of how AWT components fit together. In working with components, for example, you'll see how events fit into the overall picture, what they mean, and how to use them. The book includes lots of sample code, so that you can learn by example. In addition to descriptions of the standard layout managers, for instance, you'll find an extended code example for writing your own layout manager.The Java AWT Reference is part of O'Reilly's Java documentation series. This edition describes both Version 1.0.2 and Version 1.1 of the Java Development Kit and includes:

  • Easy-to-use reference material on every AWT class

  • Extended examples that demonstrate important AWT functionality

  • A detailed explanation of Java's image processing mechanisms

  • Coverage of every AWT component and container, showing how to use them in various combinations to create effective interfaces

  • Descriptions of all the layout managers, including GridBagLayout

  • The Java AWT Reference is meant to be used in conjunction with the Java Fundamental Classes Reference. Together, these two reference manuals cover all of the classes in the the Java Core API. The Java Language Reference completes the package, providing a complete reference on the Java programming language. These manuals comprise the definitive set of Java documentation that you need to do serious programming with Java.O'Reilly & Associates also publishes an introductory text,Exploring Java, if you need to get up to speed with this exciting new technology. For advanced Java programming topics, look for upcoming books from O'Reilly on network programming, distributed computing, and database programming. And as new Java APIs become available, O'Reilly is committed to expanding the Java series to cover those as well.

    Table of Contents

    1. Cover Page
    2. Title Page
    3. Preface
      1. New Features of AWT in Java 1.1
      2. What This Book Covers
      3. About the Source Code
      4. Other Java Books and Resources
      5. About Java
      6. Conventions Used in This Book
      7. Request for Comments
      8. Acknowledgments
    4. 1: Abstract Window Toolkit Overview
      1. 1.1 Components
      2. 1.2 Peers
      3. 1.3 Layouts
      4. 1.4 Containers
      5. 1.5 And the Rest
      6. 1.6 Summary
    5. 2: Simple Graphics
      1. 2.1 Graphics
      2. 2.2 Point
      3. 2.3 Dimension
      4. 2.4 Shape
      5. 2.5 Rectangle
      6. 2.6 Polygon
      7. 2.7 Image
      8. 2.8 MediaTracker
    6. 3: Fonts and Colors
      1. 3.1 Fonts
      2. 3.2 FontMetrics
      3. 3.3 Color
      4. 3.4 SystemColor
      5. 3.5 Displaying Colors
      6. 3.6 Using Desktop Colors
    7. 4: Events
      1. 4.1 Java 1.0 Event Model
      2. 4.2 The Event Class
      3. 4.3 The Java 1.1 Event Model
    8. 5: Components
      1. 5.1 Component
      2. 5.2 Labels
      3. 5.3 Buttons
      4. 5.4 A Simple Calculator
      5. 5.5 Canvas
      6. 5.6 Creating Your Own Component
      7. 5.7 Cursor
    9. 6: Containers
      1. 6.1 Container
      2. 6.2 Panel
      3. 6.3 Insets
      4. 6.4 Window
      5. 6.5 Frames
      6. 6.6 Dialogs
      7. 6.7 FileDialog
    10. 7: Layouts
      1. 7.1 The LayoutManager Interface
      2. 7.2 FlowLayout
      3. 7.3 BorderLayout
      4. 7.4 GridLayout
      5. 7.5 CardLayout
      6. 7.6 GridBagLayout
      7. 7.7 GridBagConstraints
      8. 7.8 Combining Layouts
      9. 7.9 Disabling the LayoutManager
      10. 7.10 Designing Your Own LayoutManager
      11. 7.11 The sun.awt Layout Collection
      12. 7.12 Other Layouts Available on the Net
    11. 8: Input Fields
      1. 8.1 Text Component
      2. 8.2 TextField
      3. 8.3 TextArea
      4. 8.4 Extending TextField
    12. 9: Pick Me
      1. 9.1 Choice
      2. 9.2 Lists
      3. 9.3 Checkbox
      4. 9.4 CheckboxGroup
      5. 9.5 ItemSelectable
    13. 10: Would You Like to Choose from the Menu?
      1. 10.1 MenuComponent
      2. 10.2 MenuContainer
      3. 10.3 MenuShortcut
      4. 10.4 MenuItem
      5. 10.5 Menu
      6. 10.6 CheckboxMenuItem
      7. 10.7 MenuBar
      8. 10.8 Putting It All Together
      9. 10.9 PopupMenu
    14. 11: Scrolling
      1. 11.1 Scrollbar
      2. 11.2 Scrolling An Image
      3. 11.3 The Adjustable Interface
      4. 11.4 ScrollPane
    15. 12: Image Processing
      1. 12.1 ImageObserver
      2. 12.2 ColorModel
      3. 12.3 ImageProducer
      4. 12.4 ImageConsumer
      5. 12.5 ImageFilter
    16. 13: AWT Exceptions and Errors
      1. 13.1 AWTException
      2. 13.2 IllegalComponentStateException
      3. 13.3 AWTError
    17. 14: And Then There Were Applets
      1. 14.1 What's a Java Applet?
      2. 14.2 AudioClip Interface
      3. 14.3 AppletContext Interface
      4. 14.4 AppletStub Interface
      5. 14.5 Audio in Applications
    18. 15: Toolkit and Peers
      1. 15.1 Toolkit
      2. 15.2 The Peer Interfaces
    19. 16: Data Transfer
      1. 16.1 DataFlavor
      2. 16.2 Transferable Interface
      3. 16.3 ClipboardOwner Interface
      4. 16.4 Clipboard
      5. 16.5 StringSelection
      6. 16.6 UnsupportedFlavorException
      7. 16.7 Reading and Writing the Clipboard
    20. 17: Printing
      1. 17.1 PrintGraphics Interface
      2. 17.2 PrintJob Class
      3. 17.3 Component Methods
      4. 17.4 Printing Example
      5. 17.5 Printing Arbitrary Content
    21. 18: java.applet Reference
      1. 18.1 Applet
      2. 18.2 AppletContext
      3. 18.3 AppletStub
      4. 18.4 AudioClip
    22. 19: java.awt Reference
      1. 19.1 AWTError
      2. 19.2 AWTEvent
      3. 19.3 AWTEventMulticaster
      4. 19.4 AWTException
      5. 19.5 Adjustable
      6. 19.6 BorderLayout
      7. 19.7 Button
      8. 19.8 Canvas
      9. 19.9 CardLayout
      10. 19.10 Checkbox
      11. 19.11 CheckboxGroup
      12. 19.12 CheckboxMenuItem
      13. 19.13 Choice
      14. 19.14 Color
      15. 19.15 Component
      16. 19.16 Container
      17. 19.17 Cursor
      18. 19.18 Dialog
      19. 19.19 Dimension
      20. 19.20 Event
      21. 19.21 EventQueue
      22. 19.22 FileDialog
      23. 19.23 FlowLayout
      24. 19.24 Font
      25. 19.25 FontMetrics
      26. 19.26 Frame
      27. 19.27 Graphics
      28. 19.28 GridBagConstraints
      29. 19.29 GridBagLayout
      30. 19.30 GridLayout
      31. 19.31 IllegalComponentStateException
      32. 19.32 Image
      33. 19.33 Insets
      34. 19.34 ItemSelectable
      35. 19.35 Label
      36. 19.36 LayoutManager
      37. 19.37 LayoutManager2
      38. 19.38 List
      39. 19.39 MediaTracker
      40. 19.40 Menu
      41. 19.41 MenuBar
      42. 19.42 MenuComponent
      43. 19.43 MenuContainer
      44. 19.44 MenuItem
      45. 19.45 MenuShortcut
      46. 19.46 Panel
      47. 19.47 Point
      48. 19.48 Polygon
      49. 19.49 PopupMenu
      50. 19.50 PrintGraphics
      51. 19.51 PrintJob
      52. 19.52 Rectangle
      53. 19.53 ScrollPane
      54. 19.54 Scrollbar
      55. 19.55 Shape
      56. 19.56 SystemColor
      57. 19.57 TextArea
      58. 19.58 TextComponent
      59. 19.59 TextField
      60. 19.60 Toolkit
      61. 19.61 Window
    23. 20: java.awt.datatransfer Reference
      1. 20.1 Clipboard
      2. 20.2 ClipboardOwner
      3. 20.3 DataFlavor
      4. 20.4 StringSelection
      5. 20.5 Transferable
      6. 20.6 UnsupportedFlavorException
    24. 21: java.awt.event Reference
      1. 21.1 ActionEvent
      2. 21.2 ActionListener
      3. 21.3 AdjustmentEvent
      4. 21.4 AdjustmentListener
      5. 21.5 ComponentAdapter
      6. 21.6 ComponentEvent
      7. 21.7 ComponentListener
      8. 21.8 ContainerAdapter
      9. 21.9 ContainerEvent
      10. 21.10 ContainerListener
      11. 21.11 FocusAdapter
      12. 21.12 FocusEvent
      13. 21.13 FocusListener
      14. 21.14 InputEvent
      15. 21.15 ItemEvent
      16. 21.16 ItemListener
      17. 21.17 KeyAdapter
      18. 21.18 KeyEvent
      19. 21.19 KeyListener
      20. 21.20 MouseAdapter
      21. 21.21 MouseEvent
      22. 21.22 MouseListener
      23. 21.23 MouseMotionAdapter
      24. 21.24 MouseMotionListener
      25. 21.25 PaintEvent
      26. 21.26 TextEvent
      27. 21.27 TextListener
      28. 21.28 WindowAdapter
      29. 21.29 WindowEvent
      30. 21.30 WindowListener
    25. 22: java.awt.image Reference
      1. 22.1 AreaAveragingScaleFilter
      2. 22.2 ColorModel
      3. 22.3 CropImageFilter
      4. 22.4 DirectColorModel
      5. 22.5 FilteredImageSource
      6. 22.6 ImageConsumer
      7. 22.7 ImageFilter
      8. 22.8 ImageObserver
      9. 22.9 ImageProducer
      10. 22.10 IndexColorModel
      11. 22.11 MemoryImageSource
      12. 22.12 PixelGrabber
      13. 22.13 ReplicateScaleFilter
      14. 22.14 RGBImageFilter
    26. 23: java.awt.peer Reference
      1. 23.1 ButtonPeer
      2. 23.2 CanvasPeer
      3. 23.3 CheckboxMenuItemPeer
      4. 23.4 CheckboxPeer
      5. 23.5 ChoicePeer
      6. 23.6 ComponentPeer
      7. 23.7 ContainerPeer
      8. 23.8 DialogPeer
      9. 23.9 FileDialogPeer
      10. 23.10 FontPeer
      11. 23.11 FramePeer
      12. 23.12 LabelPeer
      13. 23.13 LightweightPeer
      14. 23.14 ListPeer
      15. 23.15 MenuBarPeer
      16. 23.16 MenuComponentPeer
      17. 23.17 MenuItemPeer
      18. 23.18 MenuPeer
      19. 23.19 PanelPeer
      20. 23.20 PopupMenuPeer
      21. 23.21 ScrollbarPeer
      22. 23.22 ScrollPanePeer
      23. 23.23 TextAreaPeer
      24. 23.24 TextComponentPeer
      25. 23.25 TextFieldPeer
      26. 23.26 WindowPeer
    27. A: Using Properties and Resources
      1. A.1 System Properties
      2. A.2 Server Properties
      3. A.3 Resource Bundles
    28. B: HTML Markup For Applets
      1. B.1 The Applet Tag
    29. C: Platform-Specific Event Handling
      1. C.1 The Results
      2. C.2 Test Program
    30. D: Image Loading
      1. D.1 How Images are Loaded
      2. D.2 A Brief Tour of sun.awt.image
    31. Index
    18.223.32.230