1 package edu.jiangxin.apktoolbox.swing.treetable;
2
3 import java.awt.Dimension;
4
5 import javax.swing.JTable;
6
7 public class MyTreeTable extends JTable {
8
9
10 public MyTreeTable(MyAbstractTreeTableModel treeTableModel) {
11 super();
12
13
14 MyTreeTableCellRenderer tree = new MyTreeTableCellRenderer(this, treeTableModel);
15
16
17 super.setModel(new MyTreeTableModelAdapter(treeTableModel, tree));
18
19
20 MyTreeTableSelectionModel selectionModel = new MyTreeTableSelectionModel();
21 tree.setSelectionModel(selectionModel);
22 setSelectionModel(selectionModel.getListSelectionModel());
23
24
25
26 setDefaultRenderer(MyTreeTableModel.class, tree);
27
28 setDefaultEditor(MyTreeTableModel.class, new MyTreeTableCellEditor(tree, this));
29
30
31 setShowGrid(false);
32
33
34 setIntercellSpacing(new Dimension(0, 0));
35
36 }
37 }