actionPerformed Problems
I have 2 JTextField objects in the same class that have an action listener associated with them. I was wondering how I can implement my actionPerformed() method so it knows which object generated the action. I have attached the relevent code, commenting out the second actionPeformed() method to show what I am trying to do.
privateChatTextField =new JTextField(27);
privateChatTextField.addActionListener(this);
publicChatTextField =new JTextField(27);
publicChatTextField.addActionListener(this);
publicvoid actionPerformed(ActionEvent evt){
String text = privateChatTextField.getText();
sendToServer("ChatOpponent" + text);
privateChatTextField.selectAll();
}
/*
public void actionPerformed(ActionEvent event) {
String text = publicChatTextField.getText();
sendToServer("ChatAll" + text);
publicChatTextField.selectAll();
}
*/

