O'Reilly logo

Java All-in-One For Dummies, 4th Edition by Doug Lowe

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

Chapter 4

Choosing from a List

In This Chapter

arrow Combo boxes

arrow Lists

arrow Spinners

arrow Trees

A whole category of Swing components is designed to let the user choose one or more items from a list. This chapter presents four such controls. The first three — JList, JComboBox, and JSpinner — are straightforward. The fourth — JTree — is a bit more complicated but worth the effort.

warning.eps If you put a JTree control in a frame, your friends will surely think you're some kind of guru. They'll start pestering you with questions and asking for your help. As a result, use this component only if your application really needs it — and if you feel up to the technical challenge of figuring out how it works.

Using Combo Boxes

warning.eps A combo box is a combination of a text field and a drop-down list from which the user can choose a value. If the text-field portion of the control is editable, the user can enter a value in the ...

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