Summary

You now know how to paint a user interface onto a Java application window using the components of the Swing package. The same techniques could be applied to applets, a container similar in many ways to a frame.

Swing includes classes for many of the buttons, bars, lists, and fields you would expect to see on a program, along with more advanced components such as sliders, dialog boxes, and progress bars. Interface components are implemented by creating an instance of their class and adding it to a container—such as a frame or an applet window—using the container's add() method.

Today you developed components and added them to a program. During the next two days, you learn more about two things that are needed to make a graphical interface ...

Get Sams Teach Yourself Java 2 in 21 Days, Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.