JTable has three supporting models: a table model, a column model, and a list-selection model. The table model is for storing and processing data. The column model represents all the columns in the table. The list-selection model is the same as the one used by JList for selecting rows, columns, and cells in a table. JTable also has two useful supporting classes, TableColumn and JTableHeader . TableColumn contains the information on a particular column. JTableHeader contains the information on the header of a JTable . Each column has a default editor and renderer. You can also create a custom editor by implementing the TableCellEditor interface, and you can create a custom renderer by implementing the TableCellRenderer interface.
Like JTable , JTree is a very complex component with many supporting interfaces and classes. While JTree displays the tree, the data representation of the tree is handled by TreeModel , TreeNode , and TreePath . TreeModel represents the entire tree, TreeNode represents a node, and TreePath represents a path to a node. Unlike the ListModel or TableModel , the tree model does not directly store or manage tree data. Tree data is stored and managed in TreeNode and TreePath . A TreePath is an array of Object s that are vended from a TreeModel . The elements of the array are ordered such that the root is always the first element (index 0) of the array. The TreeSelectionModel interface handles tree node selection. The DefaultTreeCellRenderer class provides a default tree node renderer that can display a label and/or an icon in a node. The DefaultTreeCellEditor can be used to edit the cells in a text field. The TreePath class is a support class that represents a set of nodes in a path.
JTable and JTree are in the javax.swing package, but their supporting interfaces and classes are all included in the javax.swing.tree and javax.swing.table packages, respectively.