我打印简单的值来JTextArea使用简单的for循环追加,当我运行它时,如果我在控制台输出中打印值,它就正常运行...
但是如果我JTextArea在文本区域中追加并打印值,则在整个程序运行后将它们全部附加.
public class SwingThread {
private JFrame frame;
/**
* Launch the application.
*/
public static void main(String[] args) {
EventQueue.invokeLater(new Runnable() {
public void run() {
try {
SwingThread window = new SwingThread();
window.frame.setVisible(true);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
/**
* Create the application.
*/
public SwingThread() {
initialize();
}
/**
* Initialize the contents of the frame.
*/
private void initialize() {
frame = new JFrame();
frame.setBounds(100, 100, …Run Code Online (Sandbox Code Playgroud)