Pregunta

I have a JText area in my program contain a text, and I want to add more text to it, when a button is pressed but without deleting the text that it already has on it. for example

JTextArea Text = new JTextArea("including; ");

When a button is pressed, I have to add another text but without deleting the one it has already, like so;

Text.setText("including button1");

and when another button is pressed it should look like this

Text.setText("including; button1, button2");

What is the most effective way of doing this?

¿Fue útil?

Solución

Use the append feature, like this

Text.append("button1,");

place this in the button / s and just write the name of the button

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top