It is one of the methods that each Button object has. (Buttons are objects, so they have identity, state, and behavior as do all objects.)
Here is the program so far, but with some new blanks.
public class TwoButtons extends JFrame implements ActionListener { JButton redButton ; JButton grnButton ; // constructor for TwoButtons public TwoButtons() { redButton = new JButton("Red"); grnButton = new JButton("Green"); getContentPane().setLayout( new FlowLayout() ); getContentPane().add( redButton ); getContentPane().add( grnButton ); // register the buttonDemo frame // (the frame this constructor is making) // as the listener for both Buttons. redButton.addActionListener( this ); grnButton.addActionListener( this ); _________.setActionCommand( _______ ); _________.setActionCommand( _______ ); } . . . . }