guess12345
07-17-2004, 04:04 AM
I have a general idea how event handlers work in java. My question is if I have two buttons:
JButton buttonOne = new JButton("ADD");
buttonOne.addActionListener(this);
JButton two = new JButton("ADD");
buttonTwo.addActionListener(this);
How do I make it so that the add button associates with buttonOne does one thing and the add button associates with buttonTwo does another thing?
I have tried the following but both buttons does the same thing when I click on it:
......e.getActionCommand().equals("ADD");
Any help would be nice....
JButton buttonOne = new JButton("ADD");
buttonOne.addActionListener(this);
JButton two = new JButton("ADD");
buttonTwo.addActionListener(this);
How do I make it so that the add button associates with buttonOne does one thing and the add button associates with buttonTwo does another thing?
I have tried the following but both buttons does the same thing when I click on it:
......e.getActionCommand().equals("ADD");
Any help would be nice....