How do i make the output come in different columns?

后端 未结 2 1586
一个人的身影
一个人的身影 2020-12-21 19:12

Im making a program that outputs, the numbers 1-10 in one column, the square of this in another and in the third the number in cube.

How can i make the program a lit

2条回答
  •  孤城傲影
    2020-12-21 19:48

    It's better to use JTable in your case.

    But you can use HTML Tags and do something like this:

    builder.append("");
    string.append("");
    string.append("
    column1column2
    "); string.append(.....); string.append(""); ... string.append("
    ");

    Or:

    textArea.setText("column1\t\tcolumn2\n");  
    textArea.append("column1\t\tcolumn2\n");  
    textArea.append(...);  
    

    But it's not recommended since your text can go out of the column.

提交回复
热议问题