for(int i=0; i < list.length; i++)
{
System.out.printf(" %2d",list[i]); // Formats right justified
if ((i+1)%10==0)
{
System.out.println(); // Adds a new line after 10 values
}
}
I'm trying to display the output of an AVL Tree inorder, preorder, and postorder traversals on multiple lines in the JTextArea(), preferably 10 numbers to a line. I tried it in the JTextArea() by adding 5 and 10 to the JTextArea() parameter (JTextArea(5, 10)), but it doesn't work. If so, how can the 'for' loop provided be altered to accomplish this? Thank you for all your help.