Hello, all. I have the following code in my init() method:
friend = new JTextField(TEXT_FIELD_SIZE); friend.setActionCommand("Add Friend"); add(friend, WEST); add(new JButton("Add Friend"), WEST); canvas = new FacePamphletCanvas(); add(canvas); addActionListeners();
and the following code in my actionPerformed submethod:
public void actionPerformed(ActionEvent e) { String cmd = e.getActionCommand(); if(cmd.equals("Add")) addProfile(); if(cmd.equals("Delete")) deleteProfile(); if(cmd.equals("Lookup")) lookupProfile(); if(cmd.equals("Change Status")) changeStatus(); if(cmd.equals("Change Picture")) changePicture(); if(cmd.equals("Add Friend")) addFriend(); }
I'm using Eclipse as my compiler. I used the debugging tools to discover that when I hit the ENTER key, my program is not recognizing the ActionEvent. It does recognize the ActionEvent when I hit the JButton with the same ActionCommand. Any suggestions? Thank you!