小编vin*_*tes的帖子

如何在 JTextField 中创建新行以输入?

我想制作一个 Swing 程序来更新你所做的事情。它将所有信息写在一个不可编辑的JTextField.

例如:

You have changed the text to BLUE.
You have changed the text to RED.
Run Code Online (Sandbox Code Playgroud)

问题是我不能把两条线分开。

我得到的是这样的:

You have changed the text to BLUE. You have changed the text to RED.
Run Code Online (Sandbox Code Playgroud)

我试过的是这样的:(这不起作用)

TF_BetInfo.setText(TF_BetInfo.getText() + "\nYou have changed the text to BLUE.");
TF_BetInfo.setText(TF_BetInfo.getText() + "\nYou have changed the text to RED.");
Run Code Online (Sandbox Code Playgroud)

java swing multiline jtextfield

1
推荐指数
1
解决办法
1万
查看次数

标签 统计

java ×1

jtextfield ×1

multiline ×1

swing ×1