I want to create a little swing application that takes input from the text field and puts it in a ArrayList. The code is not working and I need some help. 
EDIT. Fixed the syntax. Now the i cant get the code to work. It wont add the textfield data to the list. Please help.
Here is the code:
public class GUI extends JPanel implements ActionListener{
JButton button = new JButton(" >> CLICK ME <<");
final JTextField txt = new JTextField("Enter player name.");
static List <String> player = new ArrayList <String> ();
public GUI(){
    txt.setBounds(1, 1, 300, 30);
    JButton button = new JButton(" >> ADD PLAYER <<");
    button.setBounds(40, 40, 200, 40);
    setLayout(null);
    add(txt);
    add(button);
    button.addActionListener(this);
}
public void actionPerformed(ActionEvent e) {
    if (e.getSource().equals(button)) {
        player.add(txt.getText());
        System.out.println("Added: " + txt.getText() + " to the list.");
    }
    else
        System.out.println("Adding the textField data to the list did not work.");
}
public static void main(String[] args) {
    JFrame frame1 = new JFrame("Memory Game. Add player function.");
    frame1.getContentPane().add(new GUI());
    frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame1.setSize(310, 130);
    frame1.setVisible(true);
}
I am new to swing and have only been coding for a couple of weeks. :/
 
     
     
     
    