Premier dépôt
This commit is contained in:
parent
bec741e30a
commit
7fd8a07154
45
JTreeExample.java
Normal file
45
JTreeExample.java
Normal file
@ -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 ();
|
||||
}
|
||||
|
||||
|
||||
}
|
Loading…
Reference in New Issue
Block a user