Wednesday 15 June 2011

java - Append node to Parent based on user TextField and JComboBox input -


I am creating a tree's translucent program that allows users to run BFS and DFS traversal, as well as Adds and removes nodes.

The one I'm stuck is getting the node from Jacobombox and sending it to addendNode () . I want to receive it:

Enter image details here < P> First of all, I add a group of nodes and connect ... ... addNode () adds nodes in the nodelight .

Then I will send all the nodes to JComboBox guardian :

  (nodes n: node list) {parents.addItem (n.getValue ( )); }   

As you can see above, the nodes have been successfully added to JComboBox.

Then I will create a new square:

  // send to the selected parents from the combo box; Encoded child ac = new append child (child, parent); This.child.addActionListener (ac); This.AddButton.addActionListener (AC);   

which uses this class ...

  class AppendChildren implementation ActionListener {Private TextField child; Private JComboBox parents; Private index index; Public-educated children (Textfield children, Jessimobox parents, int parent index) {this.child = child; This.parents = parent; This.index = parentIndex; } Public Numerology (ActionEvent ae) {// Set maximum input in maximum characters (if child .gettext (). Length () & lt; = 0} {addMoreMessage = "Please give your child name ..."; } And {addMoreMessage = ""; } If (child.gettext (). Length ()> 1) {child.setText (child.getText). Substring (0,1)); } String childName = child.getText (); Parents.setSelectedIndex (index); Nodes newChild = new nodes (childName, nodeX, nodeY, nodewidth, node high); Ependonode (Parentnode, New Child); }}   

Which calls Ependonodes (nodes parent, nodes child) {<> Connect to the nodes and recreate the adjacency matrix.

My question is: How can I get selected nodes from Jakobobox and pass it to appendNode () ? I'm able to fix string values ​​from TextField ...

Thanks!

No comments:

Post a Comment