The actionPerformed Method
public void actionPerformed(ActionEvent e) {
// Retrieve text field
int val = Integer.parseInt(valField.getText());
if (e.getSource() == incButton)
val++;
else
val--;
// Update text field
valField.setText(Integer.toString(val));
}
Previous slide
Next slide
Back to first slide
View graphic version