O'Reilly logo

Ivor Horton's Beginning Java™ 2, JDK™ 5th Edition by Ivor Horton

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

17.9. Summary

In this chapter you have learned how to create an application window, and how to use containers in the creation of the GUI for a program. I discussed the following important points:

  • The package javax.swing provides classes for creating a graphical user interface (GUI).

  • A component is an object that is used to form part of the GUI for a program. All components have the class Component as a superclass.

  • A container is a component that can contain other components. A container object is created with a class that is a subclass of Container. The classes JPanel, JApplet, JWindow, JFrame, and JDialog are containers.

  • The class JApplet is the base class for an applet. The JFrame class is a base class for an application window with a title bar, borders, and a menu.

  • The arrangement of components in a container is controlled by a layout manager.

  • The default layout manager for the content pane of JFrame, JApplet, and JDialog objects is BorderLayout.

  • The GridBagLayout provides the most flexible control of the positioning of components in a container. The position of a component in a GridBagLayout is controlled by a GridBagConstraints object.

  • A Box container can be used to arrange components or containers in rows and columns. You can use multiple nested Box containers in combination to easily create complex arrangements that otherwise might require GridBagLayout to be used.

  • A layout manager of type SpringLayout arranges components by applying constraints in the form of Spring objects to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required