/* Program : 13 Program to implement the concept of creating Treeview according to your marks of each subject of each semester under Gujarat Technological University,Ahmedabad Development Status : Completed and Tested Developed by : Malhar Vora Developed on : 20-11-2010 Email : vbmade2000@gmail.com WebSite : www.malhar2010.blogspot.com ***********************************************************************************************************************************************/ import javax.swing.*; import javax.swing.event.*; import javax.swing.tree.*; import java.awt.*; import java.awt.event.*; public class P13 extends JFrame { JTree mainTree = null; //GTU Node DefaultMutableTreeNode rootNode=null; //Semester Nodes DefaultMutableTreeNode nodeSem1=null; DefaultMutableTreeNode nodeSem2=null; DefaultMutableTreeNode nodeSem3=null; //First Sem Subjects DefaultMutableTreeNode nodePlSql=null; DefaultMutableTreeNode nodeAccount=null; DefaultMutableTreeNode nodeCPractical=null; DefaultMutableTreeNode nodeFop=null; DefaultMutableTreeNode nodeFco=null; DefaultMutableTreeNode nodeDm=null; DefaultMutableTreeNode nodeDbms=null; //Second Sem Subjects DefaultMutableTreeNode nodeToc=null; DefaultMutableTreeNode nodeConm=null; DefaultMutableTreeNode nodeCpp=null; DefaultMutableTreeNode nodeCppPractical=null; DefaultMutableTreeNode nodeDBMS2=null; DefaultMutableTreeNode nodeDs=null; DefaultMutableTreeNode nodeDsPractical=null; //Third Sem Subjects DefaultMutableTreeNode nodeJava=null; DefaultMutableTreeNode nodeJavaPractical=null; DefaultMutableTreeNode nodeConsm=null; DefaultMutableTreeNode nodeSs=null; DefaultMutableTreeNode nodeOs=null; DefaultMutableTreeNode nodeOsPractical=null; DefaultMutableTreeNode nodeSoodam=null; P13() { rootNode = new DefaultMutableTreeNode ("Gujarat Technological University"); nodeSem1 = new DefaultMutableTreeNode ("Semester 1"); nodeSem2 = new DefaultMutableTreeNode ("Semester 2"); nodeSem3 = new DefaultMutableTreeNode ("Semester 3"); //First Sem Nodes nodePlSql = new DefaultMutableTreeNode ("PLSQL"); nodeAccount = new DefaultMutableTreeNode ("Account and ERP"); nodeCPractical = new DefaultMutableTreeNode ("C Practical"); nodeFop = new DefaultMutableTreeNode ("FOP"); nodeFco = new DefaultMutableTreeNode ("FCO"); nodeDm = new DefaultMutableTreeNode ("Discrete Mathematics"); nodeDbms = new DefaultMutableTreeNode ("DBMS"); //Second Sem Nodes nodeToc = new DefaultMutableTreeNode ("TOC"); nodeConm = new DefaultMutableTreeNode ("CONM"); nodeCpp= new DefaultMutableTreeNode ("C++"); nodeCppPractical = new DefaultMutableTreeNode ("CPP Practical"); nodeDBMS2 = new DefaultMutableTreeNode ("DBMS"); nodeDs = new DefaultMutableTreeNode ("Data Structures"); nodeDsPractical= new DefaultMutableTreeNode ("Data Structures Practical"); //Third Sem Nodes nodeJava = new DefaultMutableTreeNode ("Java"); nodeJavaPractical= new DefaultMutableTreeNode ("Java Practical"); nodeConsm= new DefaultMutableTreeNode ("CONSM"); nodeSs = new DefaultMutableTreeNode ("System Software"); nodeOs = new DefaultMutableTreeNode ("Operating System"); nodeOsPractical = new DefaultMutableTreeNode ("OS Practical"); nodeSoodam = new DefaultMutableTreeNode ("SOODAM"); //Adding first sem nodes to 1st sem main node nodePlSql.add(new DefaultMutableTreeNode("40")); nodeSem1.add(nodePlSql); nodeAccount.add(new DefaultMutableTreeNode("40")); nodeSem1.add(nodeAccount); nodeCPractical.add(new DefaultMutableTreeNode("70")); nodeSem1.add(nodeCPractical); nodeFop.add(new DefaultMutableTreeNode("45")); nodeSem1.add(nodeFop); nodeFco.add(new DefaultMutableTreeNode("50")); nodeSem1.add(nodeFco); nodeDm.add(new DefaultMutableTreeNode("30")); nodeSem1.add(nodeDm ); nodeDbms.add(new DefaultMutableTreeNode("20")); nodeSem1.add(nodeDbms); //Adding second sem nodes to 2nd sem main node nodeToc.add(new DefaultMutableTreeNode("20")); nodeSem2.add(nodeToc); nodeConm.add(new DefaultMutableTreeNode("50")); nodeSem2.add(nodeConm ); nodeCpp.add(new DefaultMutableTreeNode("57")); nodeSem2.add(nodeCpp); nodeCppPractical.add(new DefaultMutableTreeNode("37")); nodeSem2.add(nodeCppPractical); nodeDBMS2.add(new DefaultMutableTreeNode("35")); nodeSem2.add(nodeDBMS2); nodeDs.add(new DefaultMutableTreeNode("10")); nodeSem2.add(nodeDs); nodeDsPractical.add(new DefaultMutableTreeNode("20")); nodeSem2.add(nodeDsPractical); //Adding third sem nodes to 3rd sem main node nodeJava.add(new DefaultMutableTreeNode("35")); nodeSem3.add(nodeJava); nodeJavaPractical.add(new DefaultMutableTreeNode("35")); nodeSem3.add(nodeJavaPractical); nodeConsm.add(new DefaultMutableTreeNode("35")); nodeSem3.add(nodeConsm); nodeSs.add(new DefaultMutableTreeNode("35")); nodeSem3.add(nodeSs); nodeOs.add(new DefaultMutableTreeNode("35")); nodeSem3.add(nodeOs); nodeOsPractical.add(new DefaultMutableTreeNode("35")); nodeSem3.add(nodeOsPractical); nodeSoodam.add(new DefaultMutableTreeNode("35")); nodeSem3.add(nodeSoodam); rootNode.add(nodeSem1); rootNode.add(nodeSem2); rootNode.add(nodeSem3); mainTree = new JTree(rootNode); setSize(400,500); setDefaultCloseOperation(EXIT_ON_CLOSE); setTitle("Program 13 - Developed by Malhar Vora"); setVisible(true); this.getContentPane().add(mainTree); } public static void main(String []str) { P13 p = new P13(); } }
Saturday, November 20, 2010
Program to implement the concept of creating Treeview
Labels:
Java
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment
Note: Only a member of this blog may post a comment.