Catálogo de publicaciones - libros

Compartir en
redes sociales


The Definitive Guide to Java Swing

John Zukowski

Third Edition.

Resumen/Descripción – provisto por la editorial

No disponible.

Palabras clave – provistas por la editorial

Software Engineering/Programming and Operating Systems

Disponibilidad
Institución detectada Año de publicación Navegá Descargá Solicitá
No detectada 2005 SpringerLink

Información

Tipo de recurso:

libros

ISBN impreso

978-1-59059-447-6

ISBN electrónico

978-1-4302-0033-8

Editor responsable

Springer Nature

País de edición

Reino Unido

Fecha de publicación

Información sobre derechos de publicación

© Apress 2005

Tabla de contenidos

Swing Overview

John Zukowski

This chapter provided a brief overview of what will be covered in this book, such as the many essential parts of the Swing component set you need to understand in order to use Swing components. The combined set of javax.swing packages is larger than the entire first JDK, if not the first two.

In Chapter 2, you’ll explore how to deal with the many aspects of event handling using the Swing components. In addition to reviewing the delegation-based event model, you’ll look at different ways you can deal with events when using Swing components and get a grasp of the focus traversal policies involved with Swing.

Pp. 1-15

Event Handling with the Swing Component Set

John Zukowski

In this chapter, you looked at the many ways of dealing with event handling when using Swing components. Because Swing components are built AWT components, you can use the delegation-based event-handling mechanism common with those components. You then learned about the multithreading limitations of the Swing components and how to get around them with the invokeAndWait() and invokeLater() methods of EventQueue. You also explored how the Swing components use the JavaBeans PropertyChangeListener approach for notification of bound property changes.

Besides exploring the similarities between the Swing components and AWT components, you also looked at several of the new features that the Swing library offers. You explored the Action interface and how it can simplify complex user-interface development by completely separating the event-handling task from the visual component. You looked at the technique for registering KeyStroke objects to components to simplify listening for key events. Finally, you explored Swing’s focus management capabilities and how to customize the focus cycle and use the FocusTraversalPolicy and KeyboardFocusManager, as well as validating input with the InputVerifier.

In Chapter 3, you’ll meet the Model-View-Controller (MVC) architecture of the Swing component set. You’ll learn how MVC can make your user interface development efforts much easier.

Pp. 17-57

The Model-View-Controller Architecture

John Zukowski

This chapter provided a quick look at how the Swing components use a modified MVC architecture. You explored what makes up this modified architecture and how one particular component, the JTextArea, maps into this architecture. In addition, the chapter discussed the sharing of data models between components and listed all the data models for the different Swing components.

In Chapter 4, you’ll start to look at the individual components that make up the Swing component library. In addition, you’ll explore the Swing component class hierarchy as you examine the base JComponent component from the Swing library.

Pp. 59-65

Core Swing Components

John Zukowski

In this chapter, you explored the root of all Swing components: the JComponent class. From there, you looked at some of the common elements of all components, such as tooltips, as well as specific components such as JLabel. You also learned how to put glyphs (nonverbal images) on components with the help of the Icon interface and the ImageIcon class, and the GrayFilter image filter for disabled icons.

You also learned about the AbstractButton component, which serves as the root component for all Swing button objects. You looked at its data model interface, ButtonModel, and the default implementation of this interface, DefaultButtonModel. Next, you looked at the JButton class, which is the simplest of the AbstractButton implementations. And lastly, you looked at the JPanel as the basic Swing container object.

In Chapter 5, you’ll start to dig into some of the more complex AbstractButton implementations: the toggle buttons.

Pp. 67-113

Toggle Buttons

John Zukowski

This chapter described the components that can be toggled: JToggleButton, JCheckBox, and JRadioButton. You’ve seen how each component uses the JToggleButton. ToggleButtonModel class for its data model and how you can group the components into a ButtonGroup. In addition, you also saw how to handle selection events for each of the components.

Chapter 6 explains how to work with the various menu-oriented Swing components.

Pp. 115-149

Swing Menus and Toolbars

John Zukowski

Chaotic neural networks have been proved to be strong tools to solve the optimization problems. In order to escape the local minima, a new chaotic neural network model called Shannon wavelet chaotic neural network was presented. The activation function of the new model is non-monotonous, which is composed of sigmoid and Shannon wavelet. First, the figures of the reversed bifurcation and the maximal Lyapunov exponents of single neural unit were given. Second, the new model is applied to solve several function optimizations. Finally, 10-city traveling salesman problem is given and the effects of the non-monotonous degree in the model on solving 10-city traveling salesman problem are discussed. The new model can solve the optimization problems more effectively because of the Shannon wavelet being a kind of basic function. Seen from the simulation results, the new model is powerful.

Pp. 151-209

Borders

John Zukowski

In this chapter, you learned about the use of the Border interface and its many predefined implementations. You also learned how to create predefined borders using the Factory design pattern provided by the BorderFactory class. Lastly, you saw how to define your own borders and why subclassing AbstractBorder is beneficial.

In Chapter 8, you’ll move beyond low-level components and examine the window-like container objects available in Swing.

Pp. 211-234

Root Pane Containers

John Zukowski

In this chapter, you explored the JRootPane class and how implementers of the RootPaneContainer interface rely on a JRootPane for internal component management. You also learned how in Swing you work with the JRootPane of a JFrame, JDialog, JWindow, JApplet, or JInternalFrame class. The root pane can then layer components with the help of a JLayeredPane in such a way that tooltip text and pop-up menus will always appear above their associated components.

The JInternalFrame can also reside within a desktop environment, in which a JDesktopPane and DesktopManager manage how and where the internal frames act and appear. You can also respond to internal frame events by associating InternalFrameListener implementations with a JInternalFrame.

In Chapter 9, you’ll examine the specialized pop-up components within the Swing libraries: JColorChooser, JFileChooser, JOptionPane, and ProgressMonitor.

Pp. 235-266

Pop-Ups and Choosers

John Zukowski

In this chapter, you explored the intricacies of Swing’s pop-up and chooser classes. Instead of manually creating a JDialog and filling it with the necessary pieces, the Swing component set includes support for many different pop-up and chooser classes. Starting with the JOptionPane, you learned how to create informational, question, and input pop-ups. In addition, you explored how to monitor the progress of time-consuming tasks by using the ProgressMonitor and ProgressMonitorInputStream classes.

After looking at the more general pop-up classes, you explored the specifics of Swing’s color and file chooser classes: JColorChooser and JFileChooser. From each of these two classes, you can prompt the user for the requested input and customize the display in more ways than you can imagine.

Now that you have a feel for the predefined pop-ups, it is time to move on to the LayoutManager classes in Chapter 10. With the help of the system layout managers, you can create even better user interfaces.

Pp. 267-341

Layout Managers

John Zukowski

This chapter introduced AWT’s predefined layout managers FlowLayout, BorderLayout, GridLayout, GridBagLayout, and CardLayout, as well as Swing’s predefined layout managers BoxLayout, OverlayLayout, ScrollPaneLayout, ViewportLayout, and SpringLayout. You saw how the various alignment settings affect the components within a container whenever you use a layout manager such as BoxLayout or OverlayLayout. In addition, you were introduced to the SizeRequirements class, which is used internally by BoxLayout and OverlayLayout.

In Chapter 11, you’ll look at the JScrollPane and JViewport containers, which use the ScrollPaneLayout and ViewportLayout managers, plus several other sophisticated Swing container classes.

Pp. 343-375