Rewrite java textarea content
2 answers
You need a thread to do things periodically, but be aware of using SwingWorker . Unless your GUI gets frozen.
final JTextArea ta = frame.getjTextArea1();
SwingWorker worker = new SwingWorker() {
@Override
protected Object doInBackground() throws Exception {
while (true) {
ta.setText("");
ta.setText(new Date().toString());
Thread.sleep(1000);
}
}
};
worker.execute();
0
source to share