size button from arraylist not working. HELP
Hi i have created an arraylist, and a jbutton, when i click this i want it to output the size of the arraylist. it compiles but gives noads of runtime errors. code is
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.event.*;
import java.io.*;
import java.util.*;
publicclass AddScheduleGUIextends JFrameimplements ActionListener, Serializable{
private JButton tmenu;
private JButton tButton;
private Font font;
private PrintWriter savefile;
private TeamList tTeamList;
public AddScheduleGUI(){
super("Create ");
Label title =new Label("CREATE ", JLabel.CENTER);
font =new Font("Ariel", Font.ITALIC, 30);
title.setBackground(Color.gray);
title.setForeground(Color.red);
title.setFont(font);
menu =new JButton("EXIT TO MENU");
menu.addActionListener(this);
tButton =new JButton("SIZE");
tButton.addActionListener(this);
JPanel titlePanel =new JPanel(new FlowLayout());
titlePanel.add(title);
Container contentPane = this.getContentPane();
contentPane.setLayout(new BorderLayout());
this.setBackground(Color.blue);
contentPane.setLayout(new GridLayout(5,3,5,5));
contentPane.add(titlePanel);
this.setLayout(new GridLayout(5,2));
this.add(menu);
this.add(tButton);
this.pack();
this.setVisible(true);
ClosingWindow close =new ClosingWindow();
addWindowListener(close);
TeamList tList =new TeamList();
tList.addTeam(new Team("Liverpool","Anfield"));
tList.addTeam(new Team("man u","ot"));
tList.addTeam(new Team("cheksea","sb"));
tList.addTeam(new Team("leics","fs"));
tList.addTeam(new Team("arse","emrites"));
tList.addTeam(new Team("blackburn","ewood"));
System.out.println(tList.size());
System.out.println("1st game: " + tList.get(0)+"VS" + tList.get(1));
System.out.println("2nd game: " + tList.get(1)+"VS" + tList.get(2));
System.out.println("3rd game: " + tList.get(2)+"VS" + tList.get(0));
};
publicvoid actionPerformed(ActionEvent evt)
{
if(evt.getSource() == menu)
{
new InformationGUI();
dispose();
}
elseif(evt.getSource() == tButton)
{
System.out.println("SIZE IS: " +tTeamList.size());
}
}
publicclass ClosingWindowextends WindowAdapter{
publicvoid windowClosing(WindowEvent e){
if(e.getSource() == menu){
ClosingWindow close =new ClosingWindow();
addWindowListener(close);
}
else{
System.exit(0);
}
}
}
}
Any ideas to why this is not working

