Java Swing

( 2 )


The Swing classes eliminate Java's biggest weakness: its relatively primitive user interface toolkit. Swing provides many new components and containers that allow you to build sophisticated user interfaces, far beyond what was possible with AWT. The old components have been greatly improved, and there are many new components, like trees, tables, and even text editors. It also adds several completely new features to Java's user interface capabilities: drag-and-drop, undo, and the ability to develop your own "look ...

See more details below
Available through our Marketplace sellers.
Other sellers (Paperback)
  • All (31) from $1.99   
  • New (3) from $27.99   
  • Used (28) from $1.99   
Sort by
Page 1 of 1
Showing All
Note: Marketplace items are not eligible for any coupons and promotions
Seller since 2008

Feedback rating:



New — never opened or used in original packaging.

Like New — packaging may have been opened. A "Like New" item is suitable to give as a gift.

Very Good — may have minor signs of wear on packaging but item works perfectly and has no damage.

Good — item is in good condition but packaging may have signs of shelf wear/aging or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Acceptable — item is in working order but may show signs of wear such as scratches or torn packaging. All specific defects should be noted in the Comments section associated with each item.

Used — An item that has been opened and may show signs of wear. All specific defects should be noted in the Comments section associated with each item.

Refurbished — A used item that has been renewed or updated and verified to be in proper working condition. Not necessarily completed by the original manufacturer.


Ships from: fallbrook, CA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Seller since 2015

Feedback rating:


Condition: New
Brand new.

Ships from: acton, MA

Usually ships in 1-2 business days

  • Standard, 48 States
  • Standard (AK, HI)
Seller since 2005

Feedback rating:


Condition: New
1998 Paperback New Tracking provided on most orders.

Ships from: Grand Rapids, MI

Usually ships in 1-2 business days

  • Canadian
  • International
  • Standard, 48 States
  • Standard (AK, HI)
  • Express, 48 States
  • Express (AK, HI)
Page 1 of 1
Showing All
Sort by
Sending request ...


The Swing classes eliminate Java's biggest weakness: its relatively primitive user interface toolkit. Swing provides many new components and containers that allow you to build sophisticated user interfaces, far beyond what was possible with AWT. The old components have been greatly improved, and there are many new components, like trees, tables, and even text editors. It also adds several completely new features to Java's user interface capabilities: drag-and-drop, undo, and the ability to develop your own "look and feel," or the ability to choose between several standard looks. The Swing components are all "lightweight," and therefore provide more uniform behavior across platforms, making it easier to test your software.All these new features mean that there's a lot to learn. Swing is undoubtedly way ahead of AWT — or, for that matter, any widely available user interface toolkit — but it's also a lot more complicated. It's still easy to do simple things. But once you've seen what's possible, you won't want to do the simple things.Java Swing gives you in-depth coverage of everything you need to know to take full advantage of Swing, providing detailed descriptions of every class and interface in the key Swing packages. It shows you how to use all of the new components, allowing you to build state-of-the-art user interfaces. It also discusses how the components implement the MVC (Model View Controller) architecture, so you can understand how the components are designed and subclass them intelligently. Finally, it shows how to create your own "look and feel." Throughout, Java Swing focuses on giving you the context you need to understand what you're doing. It's more than documentation; Java Swing helps you develop code quickly and effectively.Whether you're a serious Java developer, or just trying to find out what Java can do, you'll find Java Swing an indispensable guide.

"Swing," the user interface components of the Java Foundation Classes (JFC), is quickly revolutionizing user interface development. This publication provides both an excellent reference and a complete tutorial for the Swing component set. Based on Java 1.1 and 1.2 beta 4 JFC, it details UI development, the model delegate architecture and all data models. To derive the most benefit from this reference, you should be familiar with the Java language, programming concepts, inner classes and the Java 1.1 event model.

Read More Show Less

Product Details

  • ISBN-13: 9781565924550
  • Publisher: O'Reilly Media, Incorporated
  • Publication date: 9/8/1998
  • Series: Java (O'Reilly) Series
  • Edition description: Older Edition
  • Edition number: 1
  • Pages: 1258
  • Product dimensions: 7.01 (w) x 9.21 (h) x 1.91 (d)

Meet the Author

Robert Eckstein, an editor at O'Reilly, works mostly on Java books (notably Java Swing) and is also responsible for the XML Pocket Reference and Webmaster in a Nutshell, 2nd Edition. In his spare time he has been known to provide online coverage for popular conferences. He also writes articles for JavaWorld magazine. Robert holds bachelor's degrees in computer science and communications from Trinity University. In the past, he has worked for the USAA insurance company and more recently spent four years with Motorola's cellular software division. He is the co-author of Using Samba.

Marc Loy is a senior programmer at Galileo Systems, LLC, but his day job seems to be teaching Java and Perl to various companies — including Sun Microsystems. He has played with Java since the alpha days and can't find his way back to C. He is developing an interactive learning application at Galileo written entirely in Java. He received his master's degree in computer science at the University of Wisconsin-Madison, and still lives in Madison with his partner, Ron Becker. He does find time to relax by playing the piano and/or throwing darts, depending on how successful the day of teaching or programming was.

David Wood is Technical Director of Plugged In Software in Brisbane, Australia, where he works with a wonderful team producing Java custom software. In his eclectic career he has been a ship's navigator, deep sea salvage engineer, and aerospace project manager for the U.S. Navy, and consulted to Lawrence Livermore National Laboratory and Netscape. David enjoys hiking and sailing with his very patient wife and teaching his son Perl before he goes to kindergarten. David holds degrees in mechanical, electrical, aeronautical, and astronautical engineering from the U.S. Naval Postgraduate School and the Virginia Military Institute.

Read More Show Less

Read an Excerpt

Chapter 9: Internal Frames

In this Chapter:

Managing a Desktop

Certain GUI applications need to simulate a desktop environment by allowing multiple "frames" to be displayed within a single root window. These frames typically look like the normal frames you'd see on a real desktop, but are not actually known to the window manager, because they are not really windows in the normal sense of the term. For some types of applications (word processors, IDEs, etc.), this can be a very powerful approach to UI design.

In this chapter, we'll look at a collection of classes Swing provides to allow you to create this type of application in Java. At the end of the chapter, we'll provide a large sample program that shows how to implement a variety of useful features.


Before looking at each of the classes involved in the Swing desktop/internal frame model, we'll take a moment for an overview of how they all work together. Figure 9-1 shows the relationships between the classes we'll be covering in this chapter.

A JInternalFrame is a container that looks much like a JFrame. The key difference is that internal frames can only exist within some other Java container. JInternalFrame implements the following six interfaces: Accessible, MouseListener, MouseMotionListener, WindowConstants, RootPaneContainer, ComponentListener.

Each internal frame keeps a reference to an instance of the static inner class called JDesktopIcon. Like real frames, JInternalFrames can be iconified. JDesktop Icon is the class responsible for taking the place of the frame when it gets iconified.

Though it is not required, JInternalFrames are typically used inside of a JDesktopPane. JDesktopPane is an extension of JLayeredPane that adds direct support for managing a collection of JInternalFrames in layers. JDesktopPane uses an object called a DesktopManager to control how different behavior, like iconification or maximization, is carried out. A default implementation of this interface, DefaultDesktopManager, is provided. We'll see how all of this functionality is broken out as we cover the various classes and interfaces involved.

One more thing to notice about Figure 9-1 is that JInternalFrame supports a new type of listener called InternalFrameListener. This interface contains methods that match those defined by the AWT WindowListener class, but have slightly different names and take InternalFrameEvents, rather than WindowEvents, as input.

The JInternalFrame Class

JInternalFrame is a powerful addition to Java, providing the ability to create lightweight frames that exist inside other components. An internal frame is managed entirely within some other Java container, just like any other component, allowing the program complete control over iconification, maximization, resizing, etc. Despite looking like "real" windows, the underlying windowing system knows nothing of the existence of internal frames.* Figure 9-2 shows what an internal frame looks like in the different look-and-feels.

There's quite a lot to discuss about JInternalFrames, but most of their power comes when they are used inside a JDesktopPane. In this section, we will give a quick overview of the properties, constructors, and methods available in JInternalFrame, but we'll leave the more detailed discussion of using internal frames to the sections that follow.


JInternalFrame defines the properties and default values shown in Table 9-1.

The accessibleContext property is as expected. The background and foreground properties are delegated to the frame's content pane.

There are three pairs of properties that indicate whether or not something can be done to a frame and whether or not that thing is currently done to the frame.

Table 9-1. JInternalFrame Properties

They are: closable/closed, iconifiable/icon, and maximizable/maximum. Note that closed, icon, and maximum are constrained properties.

The contentPane, glassPane, layeredPane, and menuBar properties come from the RootPaneContainer interface and are taken directly from the frame's JRootPane. The rootPane property is set to a new JRootPane when the frame is constructed.

The value of the defaultCloseOperation property defaults to Windowconstants.HIDE_ON_CLOSE. This implies that when the frame is closed, its setClosed ( ) method will be called. The frame could be reopened at a later time.

The desktopIcon reflects how the frame will be displayed when iconified. A JDesktopIcon (which leaves the rendering to the L&F) is created for the frame when it is instantiated. The desktopPane property provides a convenient way to access the JDesktopPane containing the frame, if there is one.

FrameIcon is the icon painted inside the frame's titlebar (usually on the far left). By default, there is no icon. However, the basic look-and-feel checks to see if a frameIcon has been set and, if not, paints the 'Java cup" icon. This explains why an icon appears in the Windows L&F frame shown in Figure 9-2, but not in the others (which provide their own paint ( ) implementations, rather than using the one provided by the basic L&F).*

The layer property indicates the frame's current layer, if it has been placed in a JLayeredPane. The resizable property indicates whether or not the frame can be resized by dragging its edges or corners, and selected indicates whether or not the frame has been selected (this will typically determine the color of the titlebar). Note that selected is a constrained property. Title contains the string to appear on the titlebar.

The Ul property holds the current L&F implementation for the frame, and UIClassID reflects the class ID for internal frames.

Finally, the warningString property, which is always null, is used to specify the string that should appear in contexts where the frame might be insecure. This is the technique used by java.awt. Window to display a string like "Warning: Applet Window" when a Java window is displayed from an applet. Since JInternalFrames are always fully enclosed by some other top-level container, this property is always null. . . .

Read More Show Less

Table of Contents

What This Book Covers;
About the Source Code;
Chapter 1: Introducing Swing;
1.1 What Is Swing?;
1.2 Swing Features;
1.3 Swing Packages and Classes;
1.4 The Model-View-Controller Architecture;
1.5 Working with Swing;
1.6 The Swing Set Demo;
1.7 Reading this Book;
Chapter 2: Jump Starting a Swing Application;
2.1 Upgrading Your Programs;
2.2 Beyond Buttons;
2.3 A Bigger Application;
Chapter 3: Swing Component Basics;
3.1 Understanding Actions;
3.2 Sending Change Events in Swing;
3.3 The JComponent Class;
Chapter 4: Labels and Icons;
4.1 Labels;
4.2 Icons;
Chapter 5: Buttons;
5.1 Buttons;
Chapter 6: Bounded Range Components;
6.1 The Bounded-Range Model;
6.2 The JScrollBar Class;
6.3 The JSlider Class;
6.4 The JProgressBar Class;
6.5 Monitoring Progress;
Chapter 7: Lists and Combo Boxes;
7.1 Lists;
7.2 Representing List Data;
7.3 Handling Selections;
7.4 Displaying Cell Elements;
7.5 The JList Class;
7.6 Combo Boxes;
7.7 The JComboBox Class;
Chapter 8: Swing Containers;
8.1 A Simple Container;
8.2 Basic RootPaneContainers;
Chapter 9: Internal Frames;
9.1 Managing a Desktop;
9.2 Building a Desktop;
Chapter 10: Swing Dialogs;
10.1 The JDialog Class;
10.2 The JOptionPane Class;
Chapter 11: Specialty Panes and Layout Managers;
11.1 The JSplitPane Class;
11.2 The JScrollPane Class;
11.3 The JTabbedPane Class;
11.4 Layout Managers;
11.5 Other Panes;
Chapter 12: Chooser Dialogs;
12.1 The JFileChooser Class;
12.2 The File Chooser Package;
12.3 The Color Chooser;
12.4 The JColorChooser Class;
Chapter 13: Borders;
13.1 Introducing Borders;
13.2 Swing Borders;
13.3 The CompoundBorder Class;
13.4 Creating Your Own Border;
Chapter 14: Menus and Toolbars;
14.1 Introducing Swing Menus;
14.2 Menu Bar Selection Models;
14.3 The JMenuBar Class;
14.4 The JMenuItem Class;
14.5 The JPopupMenu Class;
14.6 The JMenu Class;
14.7 Selectable Menu Items;
14.8 Toolbars;
Chapter 15: Tables;
15.1 Table Columns;
15.2 Table Data;
15.3 The JTable Class;
15.4 Editing and Rendering;
15.5 Selecting Table Entries;
Chapter 16: Advanced Table Examples;
16.1 A Table with Row Headers;
16.2 Large Tables with Paging;
16.3 Charting Data with a TableModel;
Chapter 17: Trees;
17.1 A Simple Tree;
17.2 Tree Models;
17.3 Tree Nodes and Paths;
17.4 The JTree Class;
17.5 Tree Selections;
17.6 Tree Events;
17.7 Rendering and Editing;
17.8 What Next?;
Chapter 18: Undo;
18.1 The Swing Undo Facility;
Chapter 19: Text 101;
19.1 The Swing Text Components;
19.2 More to Come;
Chapter 20: Document Model and Events;
20.1 The Document Model;
20.2 Document Events;
20.3 Advanced AbstractDocument Event Model;
Chapter 21: Styled Documents and JTextPane;
21.1 Style;
21.2 A Stylized Editor;
Chapter 22: Carets, Highlighters, and Keymaps;
22.1 JTextComponent UI Properties;
Chapter 23: Text Views;
23.1 Text Views;
23.2 The View Classes;
Chapter 24: EditorKits and TextActions;
24.1 Overview of the Editor Kits;
24.2 Phew!;
Chapter 25: Programming with Accessibility;
25.1 How Accessibility Works;
25.2 The Accessibility Package;
25.3 Other Accessible Objects;
25.4 The Six Types of Accessibility;
25.5 The Accessibility Utility Classes;
25.6 Interfacing with Accessibility;
Chapter 26: Look & Feel;
26.1 How Does It Work?;
26.2 Key L&F Classes and Interfaces;
26.3 The MultiLookAndFeel;
26.4 Look-and-Feel Customization;
26.5 Creation of a Custom L&F;
Chapter 27: Swing Utilities;
27.1 General Utilities;
27.2 Editing and Rendering Utilities;
27.3 Event Utilities;
27.4 Image Utilities;
Chapter 28: Swing Under the Hood;
28.1 Creating Your Own Component;
28.2 Working with Focus;
28.3 Lightweight vs. Heavyweight Components;
28.4 Multithreading Issues with Swing;
28.5 Painting and Repainting;
Look & Feel Resources;

Read More Show Less

Customer Reviews

Average Rating 4
( 2 )
Rating Distribution

5 Star


4 Star


3 Star


2 Star


1 Star


Your Rating:

Your Name: Create a Pen Name or

Barnes & 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 & 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 & 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 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


  • - By submitting a review, you grant to Barnes & and its sublicensees the royalty-free, perpetual, irrevocable right and license to use the review in accordance with the Barnes & Terms of Use.
  • - Barnes & reserves the right not to post any review -- particularly those that do not follow the terms and conditions of these Rules. Barnes & 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 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 all of 2 Customer Reviews
  • Anonymous

    Posted October 8, 2002

    An excellent choice

    I've looked at a bunch of books covering Swing, and this is the best I've seen. It gave me all I needed to write a pretty complex Java/Swing application.

    Was this review helpful? Yes  No   Report this review
  • Anonymous

    Posted April 4, 2001

    Difficult to understand at times..

    There are some code errors in the first few programs that make them hard to understand. I had to go the the books website listing the errors to figure out what was wrong. Also, the author uses a lot of custom classes that implement or extend the java classes. This can be good or bad depending upon your skill level.

    Was this review helpful? Yes  No   Report this review
Sort by: Showing all of 2 Customer Reviews

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