Swing Button and Text Area Function
Hello everybody,
I started learning Java two months ago and started Swing today :)
After several attempts on how to give a button a function, I succeeded:
Code:
JButton generate = new JButton("Generate");
generate.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent ev) {
}
});
Now, my doubt is how to change the text of a text area when pressing a button.
So, for example:
The user opens the program and the text "HELLO DUDE 1" is written in a text area. When the button is clicked the text of a textArea will be changed to "YOU PRESSED THIS BUTTON". How can I do it? In C# this would be very easy but I'm new to Java GUI and to Java-Forums.org as well :)
Thanks in advance,
ScoutDavid