Introduction to Java Programming-Comprehensive Version (6th Edition)

 

[Page 1045]

Chapter 31. JTable and JTree

Mayan God Shel, Mexico. Photographer: Philip Coblentz. Courtesy Brand X Pictures.

Objectives

  • To display tables using JTable ( §31.2).

  • To process rows and columns using TableModel , DefaultTableModel , TableColumnModel , DefaultTableColumnModel , and ListSelectionModel ( § §31.3 “31.4).

  • To render and edit table cells using the default renderers and editors ( §31.5).

  • To render and edit table cells using the custom renderers and editors ( §31.6).

  • To handle table model events ( §31.7).

  • To display data in a tree hierarchy using JTree ( §31.8).

  • To model the structure of a tree using using TreeModel and DefaultTreeModel ( §31.9).

  • To add, remove, and process tree nodes using TreeNode , DefaultMutableTreeNode , and TreePath ( §31.10).

  • To select tree nodes and paths using TreeSelectionModel and DefaultTreeSelectionModel ( §31.11).

  • To render and edit tree nodes using the default and custom renderers and editors ( §31.13).


[Page 1046]

31.1. Introduction

The preceding chapter introduced the model-view architecture, Swing MVC, and the models in JSpinner , JList , and JComboBox . This chapter introduces JTable and JTree , and how to use the models to process data in JTable and JTree .

 

Категории