How can I add (not set) a text using a button on a text area. For example: if I have one button which add "Hello" and secound button will add " World" the result should be Hello World.
Asked
Active
Viewed 33 times
0
-
Set the value of the text equal to the original text concatenated with the new text. – D.N. Dec 08 '17 at 18:12
-
And how should I do that? – NMarian13 Dec 08 '17 at 18:19
-
2Since this seems like an assignment, I'm trying to avoid giving you an exact answer and instead plant the idea. In the concept of getters and setters, you can GET the current value and SET the new value accordingly, using the information returned from the GET. – D.N. Dec 08 '17 at 18:21
-
2If you go to the docs, you'll find that there's a method called: [`JTextArea#append`](https://docs.oracle.com/javase/7/docs/api/javax/swing/JTextArea.html#append(java.lang.String)) which does what you want – Frakcool Dec 08 '17 at 18:49