我想制作一个 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)