title: How to modify color intensity in a java swing application
body: <p>I am using java swing to create an interface where the user draws a couple of points. What I want to do is after those points are drawn to change automatically the intensity of the color from really bright to dark till the point fades. Does anyone know any tutorials on how to change the color intensity because I cannot find something to help me.</p>
  
  <p>EDIT: Thank you for your answers they helped me understand better how to work with Color class. I fixed it so I am uploading the thread part to help if anyone anyone else needs to do something similar... I am working on a black background so I darken the colors instead of lightening them.</p>
  
  <pre><code>public class MyThread extends Thread {
  
      private Canvas canvas;
      private int sleepingTime = 5000;
      private Color color;
      private int red, green, blue, alpha;
  
      public MyThread(Canvas canvas) {
          super();
          this.canvas = canvas;
          setDaemon(true);
  
      }
  
      public void run(){
          while (true){
              try {
                  System.out.println("going to sleep...");
                  Thread.sleep(sleepingTime);
  
              } catch (InterruptedException e) {
                  System.out.println("sleep interrupted..");
                  return;
              }
              System.out.println("woke up!");
                  int size = canvas.points_list.size();
                  int i =0;
                  while (size &gt; 0) {
                      color = canvas.points_list.get(i).getForeground();
  
                      red = (int) Math.round(Math.max(0, color.getRed() - 255 * 0.25f));
                      green = (int) Math.round(Math.max(0, color.getGreen() - 255 * 0.25f));
                      blue = (int) Math.round(Math.max(0, color.getBlue() - 255 * 0.25f));
  
                      alpha = color.getAlpha();
  
                      canvas.points_list.get(i).setForeground(new Color(red, green, blue, alpha));
                      size--; 
                      i++;
                  }
  
                  canvas.repaint();
          }
      }
  }
  </code></pre>