Button Event Handling
Hi. I am currently making a program that uses 3 buttons. I am having trouble with the action listener. I am trying to do events based on which button was clicked but the getSource() comparison isn't working. The whole actionPerformed event works fine when I press any of the buttons but I am having problems with specific buttons.
The part looks something like this
JButton exit=new JButton("Exit");
exit.addActionListener(this);
publicvoid actionPerformed(ActionEvent clicked)
{
if(clicked.getSource() == exit)
{
//do exit
}
I can't seem to find what's wrong with the if statement comparison. The program also uses keyevents and they work just fine using getSource() comparison. I tried doing all sorts of typecasting and stuff but I still can't get it working.

