cordial greeting,
I need someone to help me print or show the data of a tree in java in a jtextfield,
the impression in each of its paths (inorden, preorder, postOrder) by console normal print, but when it comes to mount it in interface mode and want to show it in a jtextield throws too many errors, I need your help to finish this small software,
the code is as follows
the one in the InOrden route
public void inorden(Arbol raiz)
{
if(raiz==null)
{
return;
}
else
{
inorden(raiz.izq);
System.out.println(raiz.letra);
inorden(raiz.der);
}
}
until here everything prints normal by console the tree, but the idea is to print it or show it by interface mode, I think that in a jtextield it should appear, but I have not been successful,
private void btn_inordenActionPerformed(java.awt.event.ActionEvent evt) {
// TODO add your handling code here:
inorden(raiz); // aca llamo el metodo recursivo
panelImpresion.setVisible(true); // muestro el panel donde se encuentra en jtextField llamado txt_impresion
txt_impresion.setText(raiz); // solo muestra la raiz,
}
I have also tried to store inorden (root) in a String to concatenate it and then call it in the txt_impresion, but neither, is there any way to show it as I am trying it or is it only by console ???? please help ....
I leave an image of the program, any suggestion is welcome, in advance thank you very much