background image Chris Johnson, Index
Buttons - Dont Just Compare Labels...


  1. Associate command id with button:
    b1.setActionCommand(DISABLE);


  2. Create listener for the button:
    b1.addActionListener(this);


  3. When listener called, get id:
    String command = e.getActionCommand();


  4. Compare id for several buttons:
    if (command == DISABLE)...



forward