Reputation: 330
I'm developing a small application using Java Swing. It consist of 2 textareas. While typing the text in one textarea I want the same text to be copied on other textarea.
I've used threads: thread1 for Jframe and thread2 which access the text and setText
in other textarea.. but text is not displaying.
Upvotes: 1
Views: 308
Reputation: 324098
I want the same text to be copied on other textarea
Share the Document:
JTextArea textArea1 = new JTextArea();
JTextArea textArea2 = new JTextArea();
textArea2.setDocument( textArea1.getDocument() );
Upvotes: 1
Reputation: 467
Have you used any action listener to detect when the user types in the text box?
Upvotes: 2