projects window

Please support our Java advertiser: Programming Forums - DaniWeb Sister Site
Thread Solved

Join Date: Jul 2007
Posts: 7
Reputation: jopal is an unknown quantity at this point 
Solved Threads: 0
jopal jopal is offline Offline
Newbie Poster

projects window

 
0
  #1
Jul 14th, 2007
hi hall, haw can i create a netbeans projects windows like tree in java?
tanks.
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,205
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 486
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: projects window

 
0
  #2
Jul 14th, 2007
I absolutely do not understand what you trying to say. If you ask question you better to explain it fully not in one wrong worded sentence...
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 7
Reputation: jopal is an unknown quantity at this point 
Solved Threads: 0
jopal jopal is offline Offline
Newbie Poster

Re: projects window

 
0
  #3
Jul 14th, 2007
in netbeans ide there is a projects window:
http://www.netbeans.org/download/fla...sOverview.html
how can i program something like that, I mean a tree view.
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 7
Reputation: jopal is an unknown quantity at this point 
Solved Threads: 0
jopal jopal is offline Offline
Newbie Poster

Re: projects window

 
0
  #4
Jul 14th, 2007
In netbeans there is a JTree item in Pallete window, thats what I'm looking for .
Reply With Quote Quick reply to this message  
Join Date: Dec 2004
Posts: 4,205
Reputation: peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of peter_budo has much to be proud of 
Solved Threads: 486
Moderator
Featured Poster
peter_budo's Avatar
peter_budo peter_budo is offline Offline
Code tags enforcer

Re: projects window

 
0
  #5
Jul 14th, 2007
Originally Posted by jopal View Post
In netbeans there is a JTree item in Pallete window, thats what I'm looking for .
Well that does not sort your problem if you do not understand how to use tree properly. And what will you do if you get a job in company where they do not use NetBeans and you will benot allowed to instal as they have licence for some other IDE or use only free versions?
So you better learn trees and will give few examples (duno why I do this...)
  1. /* Demonstrate a tree events
  2.  */
  3.  
  4. import java.awt.*;
  5. import javax.swing.*;
  6. import javax.swing.event.*;
  7. import javax.swing.tree.*;
  8.  
  9. class TreeEventDemo
  10. {
  11. JLabel jlab;
  12.  
  13. TreeEventDemo()
  14. {
  15. // Create a new JFrame container
  16. JFrame jfrm = new JFrame("Tree Event Demo");
  17.  
  18. // Use the default border layout manager
  19.  
  20. // give the frame an initial size
  21. jfrm.setSize(200, 200);
  22.  
  23. // terminate program when the user closes the application
  24. jfrm.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  25.  
  26. // create a label that will display the tree selection
  27. jlab = new JLabel();
  28.  
  29.  
  30. /* Begin creating the tree be defining the
  31.   * structure and realtionship of its nodes*/
  32.  
  33. // First, create the root node of the ttree
  34. DefaultMutableTreeNode root = new DefaultMutableTreeNode("Food");
  35.  
  36. /* Next, create twoo subtrees. One contains fruit.
  37.   * The other vegetables.*/
  38.  
  39. // Create the root of the Fruit subtree
  40. DefaultMutableTreeNode fruit = new DefaultMutableTreeNode("Fruit");
  41. root.add(fruit); // add the Fruit node to the tree
  42.  
  43. /* The Fruit subtree has two subtrees on its own.
  44.   * The first is Apples, the second is Pears.*/
  45.  
  46. // Create an Apples subtree
  47. DefaultMutableTreeNode apples = new DefaultMutableTreeNode("Apples");
  48. fruit.add(apples);
  49.  
  50. /* Populate the Apples subtree by adding
  51.   * apple varieties to the Apples subtree*/
  52. apples.add(new DefaultMutableTreeNode("Jonathan"));
  53. apples.add(new DefaultMutableTreeNode("Winesap"));
  54.  
  55. //Create a Pears subtree
  56. DefaultMutableTreeNode pears = new DefaultMutableTreeNode("Pears");
  57. fruit.add(pears);
  58.  
  59. // Populate the Pears subtree
  60. pears.add(new DefaultMutableTreeNode("Barlett"));
  61.  
  62. // Create the root of the Vegetables subtree
  63. DefaultMutableTreeNode veg = new DefaultMutableTreeNode("Vegetables");
  64. root.add(veg);
  65.  
  66. // Populate Vegetables
  67. veg.add(new DefaultMutableTreeNode("Beans"));
  68. veg.add(new DefaultMutableTreeNode("Corn"));
  69. veg.add(new DefaultMutableTreeNode("Potatoes"));
  70. veg.add(new DefaultMutableTreeNode("Rice"));
  71.  
  72. /* Now, create a JTree that uses the structure
  73.   * defined by the preceding statements*/
  74. JTree jtree = new JTree(root);
  75.  
  76. // Allow the tree to be edited so that model events can be generated
  77. jtree.setEditable(true);
  78.  
  79. //Set the tree selection mode to single selection
  80. TreeSelectionModel tsm = jtree.getSelectionModel();
  81. tsm.setSelectionMode(TreeSelectionModel.SINGLE_TREE_SELECTION);
  82.  
  83. // Finally, wrap the tree in scroll pane
  84. JScrollPane jscrlp = new JScrollPane(jtree);
  85.  
  86. // Listen for tree expansion events
  87. jtree.addTreeExpansionListener(new TreeExpansionListener()
  88. {
  89. public void treeExpanded(TreeExpansionEvent tse)
  90. {
  91. // Get the path to the expansion point
  92. TreePath tp = tse.getPath();
  93.  
  94. // Display the node
  95. jlab.setText("Expansion: " + tp.getLastPathComponent() );
  96. }
  97.  
  98. public void treeCollapsed(TreeExpansionEvent tse)
  99. {
  100. // Get the path to the expansion point
  101. TreePath tp = tse.getPath();
  102.  
  103. // Display the node
  104. jlab.setText("Collapse: " + tp.getLastPathComponent() );
  105. }
  106. });
  107.  
  108. // Listen for tree selection events
  109. jtree.addTreeSelectionListener(new TreeSelectionListener()
  110. {
  111. public void valueChanged(TreeSelectionEvent tse)
  112. {
  113. // Get the path to the selection
  114. TreePath tp = tse.getPath();
  115.  
  116. //Display the selected node
  117. jlab.setText("Selection event: " +tp.getLastPathComponent() );
  118. }
  119. });
  120.  
  121. // Listen for tree model events.Notice that the listener is registered with tree model
  122. jtree.getModel().addTreeModelListener(new TreeModelListener()
  123. {
  124. public void treeNodesChanged(TreeModelEvent tse)
  125. {
  126. // Get the path to the change
  127. TreePath tp = tse.getTreePath();
  128.  
  129. // Display the Path
  130. jlab.setText("Model change path: " + tp);
  131. }
  132.  
  133. /* Empty implementations of the remaining TreeModelEvent
  134.   * methods. Implement these if your application
  135.   * needs to handle these actions*/
  136. public void treeNodesInserted(TreeModelEvent tse){}
  137. public void treeNodesRemoved(TreeModelEvent tse){}
  138. public void treeStructureChanged(TreeModelEvent tse){}
  139. });
  140.  
  141. // Add the tree and label to the content pane
  142. jfrm.getContentPane().add(jscrlp, BorderLayout.CENTER);
  143. jfrm.getContentPane().add(jlab, BorderLayout.SOUTH);
  144.  
  145. // Display the frame
  146. jfrm.setVisible(true);
  147. }
  148.  
  149. public static void main(String[] args)
  150. {
  151. SwingUtilities.invokeLater(new Runnable()
  152. {
  153. public void run()
  154. {
  155. new TreeEventDemo();
  156. }
  157. });
  158. }
  159. }

The Java Tutorials How to Use Trees
Swing Tutorials JTree
and another one
Last edited by peter_budo; Jul 14th, 2007 at 10:12 am.
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)

LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Reply With Quote Quick reply to this message  
Join Date: Jul 2007
Posts: 7
Reputation: jopal is an unknown quantity at this point 
Solved Threads: 0
jopal jopal is offline Offline
Newbie Poster

Re: projects window

 
0
  #6
Jul 14th, 2007
yes, this last answer absolutely respond to my question.
peter_budo tank you very much.
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC