Chapter 3

Getting Input from the User

In This Chapter

arrow Working with text fields and areas

arrow Creating check boxes

arrow Setting radio buttons

arrow Defining borders

arrow Playing with sliders

arrow Using some of these components in a sample program

In the first two chapters of Book VI, I show you how to use two basic Swing user-interface components — labels and buttons — and how to handle events generated when the user clicks one of those buttons. If all you ever want to write are programs that display text when the user clicks a button, you can put the book down now. But if you want to write programs that actually do something worthwhile, you need to use other Swing components.

In this chapter, you find out how to use components that get information from the user. First, I cover two components that get text input from the user: text fields, which get a line of text, and text areas, which get multiple lines. ...

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.