From 7fd8a0715470a553ef7ba54bedff98ab4544df47 Mon Sep 17 00:00:00 2001 From: ELISEE VICTOIRE ISSOM BALEP Date: Fri, 17 Nov 2023 15:39:10 +0100 Subject: [PATCH] =?UTF-8?q?Premier=20d=C3=A9p=C3=B4t?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- JTreeExample.java | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 JTreeExample.java diff --git a/JTreeExample.java b/JTreeExample.java new file mode 100644 index 0000000..76b39e5 --- /dev/null +++ b/JTreeExample.java @@ -0,0 +1,45 @@ +/* + * Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license + * Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template + */ + +/** + * + * @author elyse + */ + +import javax.swing.*; +import java.awt.*; +import javax.swing.tree.DefaultMutableTreeNode; +public class JTreeExample { + JTreeExample (){ + JFrame f=new JFrame("TROUVER LE DIPLOME POUR FAIRE DE L'ART"); + f.setLayout(new FlowLayout()); + DefaultMutableTreeNode coll= new DefaultMutableTreeNode("college"); + DefaultMutableTreeNode as= new DefaultMutableTreeNode("arts & sciences"); + DefaultMutableTreeNode en= new DefaultMutableTreeNode("Engineering"); + DefaultMutableTreeNode ba= new DefaultMutableTreeNode("Ba"); + DefaultMutableTreeNode bs= new DefaultMutableTreeNode("BSc"); + DefaultMutableTreeNode bc= new DefaultMutableTreeNode("BCOM"); + DefaultMutableTreeNode be= new DefaultMutableTreeNode("BE"); + DefaultMutableTreeNode bt= new DefaultMutableTreeNode("BTech"); + JTree tree=new JTree(coll); + en.add(be);en.add(bt); + as.add(ba);as.add(bs);as.add(bc); + coll.add(as);coll.add(en); + + f.add(tree); + tree.setToggleClickCount(1); + System.out.println("click;"+tree.getToggleClickCount()); + f.setSize(200 , 200 ); + f.setVisible(true); + f.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); + } + + public static void main(String[] args) { + // TODO Auto-generated method stub + new JTreeExample (); + } + + +}