Java Reference
In-Depth Information
CHAPTER 18
■ ■ ■
Tables
C hapter 17 took an in-depth look at the Swing JTree component. In this chapter, you'll
explore the many details of the JTable component. The component is the standard Swing
component for displaying two-dimensional data in the form of a grid.
Introducing Tables
Figure 18-1 shows a simple example of a JTable . You'll notice that it includes Japanese fonts. In
order to see the Kanji ideographs in this chapter's sample programs, you will need to have the
necessary Japanese fonts installed. However, all the examples will work fine without config-
uring your environment to display Japanese fonts, but instead of seeing the ideographs, you
will see characters such as question marks or boxes, depending on your platform.
Note Windows XP Service Pack 2 users will find their systems already have the necessary Japanese fonts
for the examples in this chapter. If you don't already have them, one place to get these fonts for Windows
systems is http://ftp.monash.edu.au/pub/nihongo/ie3lpkja.exe . Solaris users must contact
Sun to request the Asian outline fonts for Solaris environments. For more information about configuring fonts
in the Java runtime environment, refer to http://java.sun.com/j2se/1.5.0/docs/guide/intl/
fontconfig.html .
Figure 18-1. Sample JTable
Like the JTree component, the JTable component relies on numerous support classes for its
inner workings. For the JTable , the support classes are found in the javax.swing.table package.
The cells within the JTable can be selected by row, column, row and column, or individual cell.
675
 
Search WWH ::




Custom Search