Class JTreeTable

All Implemented Interfaces:
ImageObserver, MenuContainer, Serializable, EventListener, Accessible, CellEditorListener, ListSelectionListener, RowSorterListener, TableColumnModelListener, TableModelListener, Scrollable
Direct Known Subclasses:
JPPFTreeTable

public class JTreeTable extends JTable
This example shows how to create a simple JTreeTable component, by using a JTree as a renderer (and editor) for the cells in a particular column in the JTable.
Version:
1.2 10/27/98
Author:
Philip Milne, Scott Violet
See Also:
  • Field Details

  • Constructor Details

    • JTreeTable

      public JTreeTable(TreeTableModel treeTableModel)
      Initialize this tree table with the specified model.
      Parameters:
      treeTableModel - this tree table's model.
  • Method Details

    • updateUI

      public void updateUI()
      Overridden to message super and forward the method to the tree. Since the tree is not actually in the component hierarchy it will never receive this unless we forward it in this manner.
      Overrides:
      updateUI in class JTable
    • getEditingRow

      public int getEditingRow()
      Workaround for BasicTableUI anomaly. Make sure the UI never tries to paint the editor. The UI currently uses different techniques to paint the renderers and editors and overriding setBounds() below is not the right thing to do for an editor. Returning -1 for the editing row in this case, ensures the editor is never painted.
      Overrides:
      getEditingRow in class JTable
    • setRowHeight

      public void setRowHeight(int rowHeight)
      Overridden to pass the new rowHeight to the tree.
      Overrides:
      setRowHeight in class JTable
    • getTree

      public JTree getTree()
      Returns the tree that is being shared between the model.
      Returns:
      a JTree instance.
    • setSelectionMode

      public void setSelectionMode(int selectionMode)
      Set the selection mode of this tree table.
      Overrides:
      setSelectionMode in class JTable
      Parameters:
      selectionMode - - one of ListSelectionModel.SINGLE_SELECTION, ListSelectionModel.SINGLE_INTERVAL_SELECTION, ListSelectionModel.MULTIPLE_INTERVAL_SELECTION.
    • createDefaultTableHeader

      protected JTableHeader createDefaultTableHeader()
      Overrides:
      createDefaultTableHeader in class JTable