import javax.swing.JFrame;
import javax.swing.JTree;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.JScrollPane;
import java.awt.Dimension;
import java.awt.FlowLayout;

class Frame extends JFrame {

    Frame()
    {
        setTitle("JTree");
        setLayout(new FlowLayout());
        setJTree();
        setSize(700,350);
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    }
 
    private void setJTree()
    {
        DefaultMutableTreeNode main = new DefaultMutableTreeNode("List of programming languages by type");
        createTree(main);
        JTree jt = new JTree(main);
        JScrollPane js = new JScrollPane(jt);
        js.setPreferredSize(new Dimension(300,300));
        add(js);
    }
 
    private void createTree(DefaultMutableTreeNode main)
    {
        DefaultMutableTreeNode sub1 = new DefaultMutableTreeNode("Assembly languages");
        sub1.add(new DefaultMutableTreeNode("Autocoder"));
        sub1.add(new DefaultMutableTreeNode("Linoleum"));
        sub1.add(new DefaultMutableTreeNode("Sphinx C"));
        DefaultMutableTreeNode sub2 = new DefaultMutableTreeNode("Procedural languages");
        sub2.add(new DefaultMutableTreeNode("C"));
        sub2.add(new DefaultMutableTreeNode("Fortran"));
        sub2.add(new DefaultMutableTreeNode("Pascal"));
        DefaultMutableTreeNode sub3 = new DefaultMutableTreeNode("Object-oriented languages");
        sub3.add(new DefaultMutableTreeNode("C++"));
        sub3.add(new DefaultMutableTreeNode("Java"));
        sub3.add(new DefaultMutableTreeNode("Ruby"));
        main.add(sub1);
        main.add(sub2);
        main.add(sub3);
    }
}

public class tree1 {
 
    public static void main(String[] args) {
     
       Frame fr = new Frame();
    }
}

// dynamic tree

//  https://imss-www.upmf-grenoble.fr/prevert/Prog/Java/swing/JTree.html

// http://www.java2s.com/Tutorials/Java/Swing_How_to/JTree/index.htm

// https://www.codejava.net/java-se/swing/jtree-basic-tutorial-and-examples

// node.addChild(treeNode);

// https://www.onlinetutorialspoint.com/java/how-to-add-dynamic-files-to-jtree.html

//  https://www.labath.org/docs/java/jdk1.2.2/Swing-Tutorial/Swing-Tutorial-JTree.html

//  https://www.decodejava.com/java-jtree.htm

// https://www.rgagnon.com/javadetails/java-0313.html 

// https://www.oreilly.com/library/view/learning-java/1565927184/ch15s02.html

// http://jexp.ru/index.php/Java_Tutorial/Swing/JTree

// https://www.javatpoint.com/java-jtree


// https://relativity.net.au/gaming/java/MutableTreeNode.html

// https://java2s.com/Tutorial/Java/0240__Swing/1120__JTree.htm

// https://java2s.com/Tutorial/Java/0240__Swing/Catalog0240__Swing.htm   ++++++

//  https://sites.google.com/site/teachmemrxymon/java/jtree


//  http://leo.ugr.es/elvira/devel/Tutorial/Java/uiswing/components/tree.html



//  http://1bestcsharp.blogspot.com/2017/09/java-add-edit-remove-jtree-node.html      a voir 


//  http://www.java2s.com/Tutorials/Java/Swing/JTree/Insert_tree_node_to_JTree_model_in_Java.htm

// http://www.java2s.com/Code/Java/Swing-JFC/AddandremovetreeNodeandexpandthetreenode.htm



//  https://www.roseindia.net/java/example/java/swing/AddNodes.shtml    +++++


//    http://www-igm.univ-mlv.fr/~berstel/Cours/CoursJava/5-Arbres.pdf



https://kodejava.org/how-do-i-get-the-selected-nodes-of-a-jtree/       +++++++

tree.setEditable(true);



JButton button = new JButton("Get Selected");
button.addActionListener(new ActionListener() {
    public void actionPerformed(ActionEvent e) {
        TreePath[] paths = tree.getSelectionPaths();

        for (TreePath path : paths) {
            System.out.println("You've selected: " + path.getLastPathComponent());
        }
    }
});




https://java-swing-tips.blogspot.com/2012/02/jcheckbox-node-jtree.html
	
	
	https://www.javaworld.com/article/2077762/core-java/swing-based-tree-layouts-with-checkboxtree.html
		
		
		https://stackoverflow.com/questions/12870908/how-to-add-checkbox-to-jtree-node-to-manage-multiselection
			
			https://github.com/aterai/java-swing-tips/tree/master/CheckBoxNodeEditor/src/java/example
				
				https://ateraimemo.com/Swing/FileSystemTreeWithCheckBox.html
				
				https://github.com/aterai/java-swing-tips/tree/master/FileSystemTreeWithCheckBox/src/java/example
					

					https://stackoverflow.com/questions/6966589/gui-component-for-folder-choosing-with-select-option
						
						https://github.com/scijava/swing-checkbox-tree/tree/master/src/main/java/org/scijava/swing/checkboxtree			
							
							https://codes-sources.commentcamarche.net/forum/affich-180417-how-to-checkbox-a-chaque-noeud-de-jtree

								
								http://jexp.ru/index.php/Java_Tutorial/Swing/JTree_Editor_Renderer +++++
									
									
									
									
									https://ateraimemo.com/Swing/CheckBoxNodeEditor.html      ++++++++++++++++
										
										
										https://ateraimemo.com/tags.html#TreeCellEditor-ref   ++++++
			
											
											
		https://www.hameister.org/JavaSwingTreeTable.html
			
			http://esus.com/example-of-treetable/  ++++++++
				https://examples.javacodegeeks.com/desktop-java/javafx/javafx-treetableview-example/		
					
  TreeTableView 
  
  https://o7planning.org/en/11149/javafx-treetableview-tutorial
  
	  https://o7planning.org/fr/11149/tutoriel-javafx-treetableview
		  
		  https://github.com/Sciss/TreeTable
			  https://www.cs.uoregon.edu/research/tau/tau_releases/tau-2.20.1/tools/src/common/src/treetable/JTreeTable.java
				  
				  https://wiki.byte-welt.net/wiki/TreeTable
					  
					  http://javanbswing.blogspot.com/2013/09/swing-treetable-example-with-root-using.html
						  
	  
	  https://docs.oracle.com/javase/8/javafx/user-interface-tutorial/tree-table-view.htm
		  
											