Listing 5. Register a listener object on the button.
    setColorButton.addActionListener(
      new ActionListener(){
        public void actionPerformed(ActionEvent e){
          //Set the color to green.
          redInt = 0;
          greenInt = 255;
          blueInt = 0;
          
          //Show the color values in the text fields.
          redField.setText("" + redInt);
          greenField.setText("" + greenInt);
          blueField.setText("" + blueInt);

        }//end action performed
      }//end new ActionListener
    );//end addActionListener