In the homework have encountered about JTree and jtable linkage problem, and later on the Internet to check a lot of, are not written all the way, so wrote a small procedure for the consolidation and for the needs of the people reference
One implementation function
1 Display the data in the corresponding table
2 realizes the linkage between JTree and jtable.
3 Add and delete a row for the corresponding table table (click one line to delete)
Two code implementation
1 JTree and jtable panel code implementation
[Java] View plain copy package library; import java.awt.borderlayout; import java.awt.dimension; import java.awt.flowlayout; import java.awt.event.*; import java.io.bufferedreader; import java.io.File; import java.io.filereader; import java.io.ioexception; import javax.swing.borderfactory; import javax.swing.jbutton; import javax.swing.jframe; import javax.swing.jpanel; import javax.swing.jscrollpane; import javax.swing.jsplitpane; import javax.swing.jtable; Import javax.swing.JTree; import javax.swing.event.*; import javax.swing.table.defaulttablemodel; import javax.swing.tree.defaultmutabletreenode; IMPORT JAVAX.SWING.TRee. treepath; import javax.swing.tree.treeselectionmodel; /** * @author HuangRong * Date 2013/11/18 * */ Public class TreeTableText extends JFrame{ /** * @param args */ private JPanel panel; public jtable table; private JButton but_Add,but_Delect; private JScrollPane treePane; private JScrollPane tablePane; private object[] node={" Borrow Books Student Information "," Borrow books Student Information "}; private defaultmutabletreenode node1, node2,top;   private DefaultTableModel tableModel1,tableModel2; private JSplitPane split; private String[] colum1 = {"Name", "School Number", "Telephone", "Library Time"}; private String[][] data1 = {{ "Lee", "1108010 ...",