/** Creates and returns the instanceof JTreeTable that will be used. */
  protected JTreeTable createTreeTable(TreeTableModel model) {
    final JTreeTable treeTable = new JTreeTable(model);
    treeTable
        .getTree()
        .getSelectionModel()
        .setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
    treeTable.setDefaultRenderer(Object.class, new ComponentsStringRenderer());
    treeTable.getTree().setCellRenderer(new VRMLComponentsCellRenderer());

    /* treeTable.getTree().addTreeSelectionListener(new TreeSelectionListener() {
        @Override
        public void valueChanged(TreeSelectionEvent e) {
            textArea.select(textArea.getText().indexOf(e.getPath().getLastPathComponent().toString()),e.getPath().getLastPathComponent().toString().length()+textArea.getText().indexOf(e.getPath().getLastPathComponent().toString()));
            //To change body of implemented methods use File | Settings | File Templates.
        }
    });  */

    return treeTable;
  }
Пример #2
0
 public void setDefaultRenderer(Class columnClass, TableCellRenderer renderer) {
   table.setDefaultRenderer(columnClass, renderer);
 }