To get Text from a JTextField, you can use the getText() method, and to write a file, you can use the BufferedWriter.
In the actionPerformed method,
we need to check which of the buttons have triggered the ActionEvent and to find that we could use the getSource method, after getting the button which triggered the event, we can use conditional statements to do appropriate work
So in general , the code in
actionPerformed
looks like this,
if(ae.getSource() == button1)
{
}
else if(ae.getSource() == button2)
{
}