I have a GUI which has a textarea and a "save button" on it. I want the text that is written in the textarea to be saved when the button is pressed. I have written this code so far:
//Creates textbox
JTextArea text = new JTextArea();
text.setBounds(48, 44, 160, 16); //int (x,y,width,height)
and
//Button
JButton saveButton = new JButton("Save");
saveButton.setBounds(10, 185, 120, 20); //int (x,y,width,height)
And I have also added it to the JPanel. Everything appears as it should, I just don't know how to save the text that is written in the textarea, I have tried googling it, but it seems like there is many ways to do so and I don't know how I can implement it in a simple way that I understand. Thanks.
EDIT: I want to save the data into a string, so I can save it into a database.