BN.com Gift Guide

Java Foundation Classes in a Nutshell

( 1 )

Overview

Java Foundation Classes in a Nutshell is an indispensable quick reference for Java programmers who are writing applications that use graphics or graphical user interfaces. The author of the bestsellingJava in a Nutshell has written fast-paced introductions to the Java APIs that comprise the Java Foundation Classes (JFC), such as the Swing GUI components and Java 2D, so that you can start using these exciting new technologies right away.This book also includes O'Reilly's classic-style, quick-reference material for...

See more details below
Other sellers (Paperback)
  • All (48) from $1.99   
  • New (6) from $26.30   
  • Used (42) from $1.99   
Sending request ...

Overview

Java Foundation Classes in a Nutshell is an indispensable quick reference for Java programmers who are writing applications that use graphics or graphical user interfaces. The author of the bestsellingJava in a Nutshell has written fast-paced introductions to the Java APIs that comprise the Java Foundation Classes (JFC), such as the Swing GUI components and Java 2D, so that you can start using these exciting new technologies right away.This book also includes O'Reilly's classic-style, quick-reference material for all of the classes in the javax.swing and java.awt packages and their numerous subpackages. This reference material covers all of the new JFC classes in the Java 2 platform, as well as the existing Java 1.1 AWT classes. Once you've learned about the JFC, you'll keep this book next to your keyboard for handy reference while you program.Java Foundation Classes in a Nutshell contains the following:

  • An overview of the architecture of graphical user interfaces built with both the new Swing API and the older AWT
  • An introduction to the important components and application services provided by the Swing API
  • An comprehensive explanation of the features of the new Java 2D graphics API
  • A complete quick reference for the graphics- and GUI-related classes in the Java 2 platform
This book is part of the two-volume set of quick references that every Java programmer needs. It is an essential companion to Java in a Nutshell, 3rd Edition, which covers the key nongraphical APIs in Java 1.2. A third volume, Java Enterprise in a Nutshell, focuses on the Java Enterprise APIs and is of interest to programmers working on server-side or enterprise Java applications.

Intended for Java programmers writing applications or applets involving graphics or graphical user interfaces and is a companion to the book entitled, "Java in a Nutshell, 3rd ed."

Read More Show Less

Product Details

  • ISBN-13: 9781565924888
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 10/28/1999
  • Series: In a Nutshell (O'Reilly) Series
  • Edition number: 1
  • Pages: 754
  • Product dimensions: 6.03 (w) x 9.02 (h) x 1.56 (d)

Meet the Author

David Flanagan is a computer programmer who spends most of his time writing about JavaScript and Java. His books with O'Reilly include Java in a Nutshell, Java Examples in a Nutshell, Java Foundation Classes in a Nutshell, JavaScript: The Definitive Guide, and JavaScript Pocket Reference. David has a degree in computer science and engineering from the Massachusetts Institute of Technology. He lives with his wife and son in the U.S. Pacific Northwest bewteen the cities of Seattle, Washington and Vancouver, British Columbia. David has a simple website at http://www.davidflanagan.com.

Read More Show Less

Read an Excerpt


Chapter 3: Swing Programming Topics

3.1 Versions of Swing

http://java.sun.com/products/jfc/. As this book goes to press, the most recent version of Swing is Swing 1.1.1. This version of Swing is bundled with Java 1.2.2 and is also available for use with Java 1.1 from the web site mentioned in the previous paragraph. Swing 1.1.1 fixes many bugs in the initial release of Swing 1.1 but does not change the Swing 1.1 API in any way. Its use is strongly recommended. Swing 1.1.1 is the last release of Swing that will be available for use with Java 1.1.

Development of Swing continues, and Java 1.3 will ship with a new version that includes a number of minor changes and improvements to the Swing API. This future release will focus on improving the existing APIs and should not add many new APIs.

3.2 Labels and HTML

In the initial releases of Swing 1.1 and Java 1.2, the JLabel, JButton, and related classes that display textual labels can display only a single line of text using a single font. In Swing 1.1.1 and Java 1.2.2, however, components like these can display multiline, multifont text using simple HTML formatting. To display formatted text, simply specify a string of HTML text that begins with an <HTML> tag. You can use this feature to present text using multiple fonts, font styles, and colors. Just as important, however, the introduction of HTML allows you to specify multiline labels.

This new formatted text display feature is available in Java 1.2.2 for the JLabel, JButton, MenuItem, JMenu, JCheckBoxMenuItem, JRadioButtonMenuItem, JTabbedPane, and JToolTip classes. It is not supported (at least in Java 1.2.2) by JCheckBox or JRadioButton, however. Formatted text display is particularly useful with JOptionPane dialog boxes (described later in this chapter), as they display text using internal JLabel objects.

3.3 Actions

javax.swing.Action interface Action interface ActionListener interface, so it actionPerformed() method. It is this Action object also has an arbitrary set of Action object has an enabled setEnabled() method that allows "Cut" Action object directly to a JMenu or JToolBar JMenuItem or JButton to JMenuItem or JButton JMenuBar or JToolBar to JMenuBar and JToolBar display an action's textual name and its Action interface helps you Action objects directly. Since Action is a kind of ActionListener, you must define an individual Action that implements the actionPerformed() method for each of your AbstractAction class is actionPerformed() method.

3.4 Tooltips

tooltip: setToolTipText() method. This toolTipText property is inherited from JComponent, so it is shared by all Swing enabled ToolTipManager object. The

 ToolTipManager.sharedInstance().setEnabled(false);

3.5 Timers

javax.swing.Timer object generates single ActionEvent events at time Timer Timer object that Timer. Timer objects just like regular Timer has addActionListener() method that you can use initialDelay property specifies how many Timer waits before firing its first ActionEvent. If the repeats true, Timer generates a new ActionEvent each time delay milliseconds passes. delay coalesce true, Timer combines ActionEvent, rather than letting a queue of

3.6 The Event Dispatch Thread

SwingUtilities.invokeLater() and SwingUtilities.invokeAndWait(). You pass a Runnable object to each method, and the run() method of this object is invokeLater() run() invokeAndWait() does run() method has completed. invokeLater() and invokeAndWait() methods do not run Runnable object right away. Instead, each Runnable object Runnable object is extracted from the event run() method. This means that invokeLater() provides a useful way to defer the

3.7 Client Properties

JComponent includes a hashtable in which it can putClientProperty() and getClientProperty() methods. Since these are JComponent methods, they are inherited by all String object. JMenu JMenuItem components. Each ActionListener setActionCommand() method (inherited from AbstractButton) to associate a string with each JMenuItem components. Then the action String in order to decide how to JMenuItem.

"JInternalFrame.isPalette"

JInternalFrame is being used as a Boolean.TRUE to change the look of the "JScrollBar.isFreeStanding"

JScrollPane sets this client property Boolean.FALSE on the JScrollBar components it creates. "JSlider.isFilled"

JSlider Boolean.TRUE causes the slider to "JToolBar.isRollover"

Boolean.TRUE on a JToolBar causes the component "JTree.lineStyle"

JTree component draws the branches of its

3.8 Keyboard Shortcuts

JButton is KeyEvent that tells Spacebar or the Enter key. Similarly, JMenu and JList respond to

3.8.1 Focus Management

"window," Tab key to Tab, Swing moves the keyboard focus from JLabel objects, do Shift-Tab, nextFocusableComponent property of your isFocusCycleRoot(). If this method returns true, the container defines a focus Ctrl-Tab to traverse to the next focus Ctrl-Shift-Tab to setFocusCycleRoot() method: the only way you isFocusCycleRoot() method. JTextArea and JEditorPane Tab key for their own Ctrl-Tab to requestFocus() method of that component. requestFocus() requestFocus() calls, set its requestFocusEnabled property to false. For example, you might set this JButton so that the user can javax.swing.FocusManager object. You can FocusManager.getCurrentFocusManager(). If FocusManager.setCurrentFocusManager(). ...

Read More Show Less

Table of Contents

Chapter 1. The Java Foundation Classes

Chapter 2. Swing and AWT Architecture
   A Simple Graphical User Interface
   Components
   Properties
   Containers and Containment
   Layout Management
   Event Handling
   Swing Component Architecture

Chapter 3. Swing Programming Topics
   Versions of Swing
   Labels and HTML
   Actions
   Tooltips
   Timers
   The Event Dispatch Thread
   Client Properties
   Keyboard Shortcuts
   Serialization
   Borders
   Icons
   Cursors
   Double-Buffering
   The Box Container
   Simple Dialogs
   JFileChooser
   JColorChooser
   Menus
   JTree and TreeModel
   JTable and TableModel
   JTextComponent and HTML Text Display
   Pluggable Look-and-Feel
   Accessibility
   Custom Components

Chapter 4. Graphics with AWT and Java 2D
   Graphics Before Java 2D
   Java 2D Graphics Attributes and Operations
   The Coordinate System
   Shapes
   Stroking Lines
   Paint
   Blending Colors with AlphaComposite
   Rendering Hints
   Fonts and Text
   Buffered Images
   Transformations with AffineTransform
   Color Spaces

Chapter 5. Printing
   Printing in Java 1.1
   Printing in Java 1.2

Chapter 6. Data Transfer
   The Data Transfer Framework
   Cut-and-Paste
   Drag-and-Drop
   A Data Source
   A Data Sink

Chapter 7. Applets
   Writing Applets
   Including Applets in HTML Files
   Applet Security

PART 2: API Quick Reference .TC 0 "How To Use This Quick Reference" 139

Chapter 8. The java.applet Package

Chapter 9. The java.awt Package

Chapter 10. The java.awt.color Package

Chapter 11. The java.awt.datatransfer Package

Chapter 12. The java.awt.dnd Package

Chapter 13. The java.awt.dnd.peer Package

Chapter 14. The java.awt.event Package

Chapter 15. The java.awt.font Package

Chapter 16. The java.awt.geom Package

Chapter 17. The java.awt.im Package

Chapter 18. The java.awt.image Package

Chapter 19. The java.awt.image.renderable Package

Chapter 20. The java.awt.peer Package

Chapter 21. The java.awt.print Package

Chapter 22. The javax.accessibility Package

Chapter 23. The javax.swing Package

Chapter 24. The javax.swing.border Package

Chapter 25. The javax.swing.colorchooser Package

Chapter 26. The javax.swing.event Package

Chapter 27. The javax.swing.filechooser Package

Chapter 28. The javax.swing.plaf Package

Chapter 29. The javax.swing.table Package

Chapter 30. The javax.swing.text Package

Chapter 31. The javax.swing.text.html Package

Chapter 32. The javax.swing.text.html.parser Package

Chapter 33. The javax.swing.text.rtf Package

Chapter 34. The javax.swing.tree Package

Chapter 35. The javax.swing.undo Package

Chapter 36. Class Index

Index

Read More Show Less

Customer Reviews

Average Rating 5
( 1 )
Rating Distribution

5 Star

(1)

4 Star

(0)

3 Star

(0)

2 Star

(0)

1 Star

(0)

Your Rating:

Your Name: Create a Pen Name or

Barnes & Noble.com Review Rules

Our reader reviews allow you to share your comments on titles you liked, or didn't, with others. By submitting an online review, you are representing to Barnes & Noble.com that all information contained in your review is original and accurate in all respects, and that the submission of such content by you and the posting of such content by Barnes & Noble.com does not and will not violate the rights of any third party. Please follow the rules below to help ensure that your review can be posted.

Reviews by Our Customers Under the Age of 13

We highly value and respect everyone's opinion concerning the titles we offer. However, we cannot allow persons under the age of 13 to have accounts at BN.com or to post customer reviews. Please see our Terms of Use for more details.

What to exclude from your review:

Please do not write about reviews, commentary, or information posted on the product page. If you see any errors in the information on the product page, please send us an email.

Reviews should not contain any of the following:

  • - HTML tags, profanity, obscenities, vulgarities, or comments that defame anyone
  • - Time-sensitive information such as tour dates, signings, lectures, etc.
  • - Single-word reviews. Other people will read your review to discover why you liked or didn't like the title. Be descriptive.
  • - Comments focusing on the author or that may ruin the ending for others
  • - Phone numbers, addresses, URLs
  • - Pricing and availability information or alternative ordering information
  • - Advertisements or commercial solicitation

Reminder:

  • - By submitting a review, you grant to Barnes & Noble.com and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Noble.com Terms of Use.
  • - Barnes & Noble.com reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & Noble.com also reserves the right to remove any review at any time without notice.
  • - See Terms of Use for other conditions and disclaimers.
Search for Products You'd Like to Recommend

Recommend other products that relate to your review. Just search for them below and share!

Create a Pen Name

Your Pen Name is your unique identity on BN.com. It will appear on the reviews you write and other website activities. Your Pen Name cannot be edited, changed or deleted once submitted.

 
Your Pen Name can be any combination of alphanumeric characters (plus - and _), and must be at least two characters long.

Continue Anonymously
Sort by: Showing 1 Customer Reviews
  • Anonymous

    Posted November 29, 2002

    a must have.

    This is a must have quick reference.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing 1 Customer Reviews

If you find inappropriate content, please report it to Barnes & Noble
Why is this product inappropriate?
Comments (optional)