Problem with and event handler?
Hey i am kinda new to java and i am writing a calendar program for my AP Computer Science class i have a buttons as my calendar dates and when they are clicked they bring up a text box to store appoints and such it was working fine and now i cant seem to find what is going on thankspublicvoid actionPerformed(ActionEvent e)
{
JButton j = (JButton) e.getSource();
if(hasAppt(j))
{
if(datesList.size() > 0)
JOptionPane.showMessageDialog(this, datesList.get(datesList.size() - 1).getAppointment(mnth, Integer.parseInt(j.getText()), yer).toString());
}
else
{
String s = (String)JOptionPane.showInputDialog("Enter your appointment",
"Appointment");
if(s ==null)
return;
else
{
datesList.add(new AppointmentHandler("Brian"));
datesList.get(datesList.size() - 1).addAppt(s, mnth, Integer.parseInt(j.getText()), yer);
}
try
{
datesList.get(datesList.size() - 1).writeObjToDisk();
}
catch(IOException excep)
{
System.out.println("Error in saving object to disk: " + excep);
}
catch(ClassNotFoundException excep)
{
System.out.println("Error in saving object to disk: " + excep);
}
}
}
and this is where it adds the buttons in another method
for(int i = 0; i < dayNum[cal.daysInMnth-1]; i++)
{
JButton dayButton =new JButton();
dayButton.setText(Integer.toString(dayNum[i]));
dayButton.setPreferredSize(new Dimension(105, 25));
dayButton.addActionListener(this);
dayButtons.add(dayButton);
pack();
}

