It is one of the methods that each JButton object has. (JButtons are objects, so they have identity, state, and behavior as do all objects.)
JButton
JButtons
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() { super( title ); redButton = new JButton("Red"); grnButton = new JButton("Green"); .setActionCommand( ); .setActionCommand( ); // register the buttonDemo frame (this) // as the listener for both Buttons. redButton.addActionListener( this ); grnButton.addActionListener( this ); setLayout( new FlowLayout() ); add( redButton ); add( grnButton ); setDefaultCloseOperation( JFrame.EXIT_ON_CLOSE ); } . . . . }
Fill in the blanks.
String