Chapter 2. Jump-Starting a Swing Application

Now that you have an overview of Swing, let’s look at a few Swing components you can put into your applications right now. This chapter shows you how to add images to buttons and how to create a rudimentary Swing application using internal frames. We won’t belabor the theory and background. You’ll find everything we talk about now (and tons more we don’t discuss here) presented in later chapters in much greater detail. We just want to show you some of the fun stuff right away.

This chapter, and only this chapter, assumes that you have prior experience with AWT and AWT-based programs that you’d like to upgrade to use lightweight Swing components. If you are new to Java, this may not be the case; you are probably interested in learning Swing without the need to upgrade AWT applications. You can either skim this chapter or skip ahead to Chapter 3, which lays a foundation for the rest of your work in Swing.

If you want to see how easily Swing components can be dropped into existing AWT applications, though, read on.

Get Java Swing, 2nd 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.