Chapter 1

Swinging into Swing

In This Chapter

arrow Examining some basic Swing concepts

arrow Fussing with frames

arrow Creating a simple Swing program

arrow Putting panels in your frames

arrow Looking at labels

arrow Beginning with buttons

arrow Leaping into layout

So far in this book, all the programs have been console-based, like something right out of the 1980s. Console-based Java programs have their place, especially when you're just starting with Java. But eventually you'll want to create programs that work with a graphical user interface, also known as a GUI.

This chapter gets you started in that direction. You use a Java GUI package called Swing to create simple GUI applications that display simple buttons and text labels. Along the way, you find out about two key classes: JFrame and JPanel, which provide the visual ...

Get Java All-in-One For Dummies, 4th 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.