Coverage Report - wjhk.jupload2.gui.filepanel.treeview.MyTreeTableSelectionModel
 
Classes in this File Line Coverage Branch Coverage Complexity
MyTreeTableSelectionModel
100 %
4/4
N/A
1
MyTreeTableSelectionModel$1
33 %
1/3
N/A
1
 
 1  
 package wjhk.jupload2.gui.filepanel.treeview;
 2  
 
 3  
 import javax.swing.ListSelectionModel;
 4  
 import javax.swing.event.ListSelectionEvent;
 5  
 import javax.swing.event.ListSelectionListener;
 6  
 import javax.swing.tree.DefaultTreeSelectionModel;
 7  
 
 8  
 /**
 9  
  * This code is taken from the tutorial written by Jörn Hameister, <A
 10  
  * HREF="http://www.hameister.org/JavaSwingTreeTable.html">available here</A>.<BR/>
 11  
  * <BR/>
 12  
  * Since the TreeTable composed of a JTree component and a JTable component, it must be ensured that in the selection of
 13  
  * the tree or table always has a continuous line is highlighted. To ensure that you create a class
 14  
  * MyTreeTableSelectionModel that extends the DefaultTreeSelectionModel. This selection model is later assigned to the
 15  
  * JTree and JTable to.
 16  
  * 
 17  
  * @author Jörn Hameister
 18  
  */
 19  
 public class MyTreeTableSelectionModel extends DefaultTreeSelectionModel {
 20  
 
 21  
     private static final long serialVersionUID = 1L;
 22  
 
 23  
     public MyTreeTableSelectionModel() {
 24  40
         super();
 25  
 
 26  40
         getListSelectionModel().addListSelectionListener(new ListSelectionListener() {
 27  
             // @Override
 28  
             public void valueChanged(ListSelectionEvent e) {
 29  0
                 System.out.print("[DEBUG] ListSelectionEvent: " + e + "\n");
 30  0
             }
 31  
         });
 32  40
     }
 33  
 
 34  
     ListSelectionModel getListSelectionModel() {
 35  80
         return listSelectionModel;
 36  
     }
 37  
 }