mev-4.0.01/source/org/tigr/util/swing/Rainbow.java

Code
Comments
Other
Rev Date Author Line
2 26 Feb 07 jari 1 /*
2 26 Feb 07 jari 2 Copyright @ 1999-2003, The Institute for Genomic Research (TIGR).
2 26 Feb 07 jari 3 All rights reserved.
2 26 Feb 07 jari 4 */
2 26 Feb 07 jari 5 /*
2 26 Feb 07 jari 6  * $RCSfile: Rainbow.java,v $
2 26 Feb 07 jari 7  * $Revision: 1.3 $
2 26 Feb 07 jari 8  * $Date: 2005/03/10 15:27:48 $
2 26 Feb 07 jari 9  * $Author: braistedj $
2 26 Feb 07 jari 10  * $State: Exp $
2 26 Feb 07 jari 11  */
2 26 Feb 07 jari 12 package org.tigr.util.swing;
2 26 Feb 07 jari 13
2 26 Feb 07 jari 14 import java.awt.Color;
2 26 Feb 07 jari 15 import java.awt.GradientPaint;
2 26 Feb 07 jari 16 import java.awt.Graphics2D;
2 26 Feb 07 jari 17 import java.util.Vector;
2 26 Feb 07 jari 18
2 26 Feb 07 jari 19 public class Rainbow {
2 26 Feb 07 jari 20     
2 26 Feb 07 jari 21     public void drawRainbow(Graphics2D g2, int x, int y, int Width, int Height) {
2 26 Feb 07 jari 22   double Step=Width/5.0;
2 26 Feb 07 jari 23   Vector Colors=new Vector();
2 26 Feb 07 jari 24   Colors.add(new Color(255,000,000));
2 26 Feb 07 jari 25   Colors.add(new Color(255,255,000));
2 26 Feb 07 jari 26   Colors.add(new Color(000,255,000));
2 26 Feb 07 jari 27   Colors.add(new Color(000,255,255));
2 26 Feb 07 jari 28   Colors.add(new Color(000,000,255));
2 26 Feb 07 jari 29   Colors.add(new Color(255,000,255));
2 26 Feb 07 jari 30   GradientPaint gp;
2 26 Feb 07 jari 31   for (int i=0; i<5; i++) {
2 26 Feb 07 jari 32       gp=new GradientPaint(x+(int)Math.round(i*Step),0,(Color)Colors.get(i),x+(int)Math.round((i+1)*Step),0,(Color)Colors.get(i+1));
2 26 Feb 07 jari 33       g2.setPaint(gp);
2 26 Feb 07 jari 34       g2.drawRect(x+(int)Math.round(i*Step),y,(int)Step,Height);
2 26 Feb 07 jari 35       g2.fillRect(x+(int)Math.round(i*Step),y,(int)Step,Height);
2 26 Feb 07 jari 36   }
2 26 Feb 07 jari 37     }
2 26 Feb 07 jari 38     
2 26 Feb 07 jari 39 }