Darkening and brightening the color

Listing 3 shows an ActionListener object being registered on the button labeled Darker in Figure 1.

Listing 3. Darkening the color.
    darkerButton.addActionListener(
      new ActionListener(){
        public void actionPerformed(ActionEvent e){
          Color color = new Color(
               redInt,greenInt,blueInt).darker();
          redField.setText("" + color.getRed());
          greenField.setText("" + color.getGreen());
          blueField.setText("" + color.getBlue());
        }//end action performed
      }//end newActionListener
    );//end addActionListener
File: ax.htm [Next] [Prev]