JaVa
   

GUI Extra Section

As well as the aforementioned GUI objects, JButton and JTextField, there are many other great components that can be used easily. In a bid to save the trees, however, we are only going to list the most useful ones here, and as a bonus, we have included a chapter on the companion CD that will give an example of each GUI object and explain how each works. This chapter can be found in the Bonus Chapter folder on the CD-ROM. Here is a complete list of the Swing components covered in this bonus chapter.

Component

What it is/does

JLabel

Used to display static text

JButton

Seen in the previous example and used to create buttons

JTextField

Again seen previously. Used to take keyboard input from the user

JPasswordField

Same as a JTextField, but the visible input is replaced by asterisks (*)

JTextArea

A component to display (or input) a large volume of text

JComboBox

Used to give a drop-down menu of a defined list of options

JCheckBox

Used for Boolean options (i.e., if some feature should be enabled or disabled)

JRadioButton

Used to create a list of selectable options in which only a single option can be picked

JProgressBar

A bar used to show progress to the user

JList

Used to display a list of data

JTable

Used to contain tabulated data. We will also see this being used in .

JTree

Used to display hierarchical information, such as the directory structure

JEditorPane

Can be used to contain HTML pages, as you will see in the bonus chapter example on the companion CD.

JOptionPane

Used to create message boxes that pop up to display simple information to the user. We have seen some of these already, such as in when choosing whether to go into full-screen or windowed mode.

JMenu

Used to create a menu at the top of your app

Tool Tips

Those little pop-up thingies that tell you what a button does

JaVa
   
Comments