Color.lightGray : Color « java.awt « Java by API






Color.lightGray

   
import java.awt.Color;
import java.awt.Graphics;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class MainClass extends JPanel {
  Color colors[] = { Color.black, Color.blue, Color.cyan, Color.darkGray,
      Color.gray, Color.green, Color.lightGray, Color.magenta, Color.orange,
      Color.pink, Color.red, Color.white, Color.yellow };

  public void paint(Graphics g) {
    int deltax = 260 / colors.length;
    for (int i = 0; i < colors.length; i++) {
      g.setColor(colors[i]);
      g.fillRect(i * deltax, 0, (i + 1) * deltax, 260);
    }

  }

  public static void main(String[] args) {
    JFrame frame = new JFrame();
    frame.getContentPane().add(new MainClass());

    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setSize(200, 200);
    frame.setVisible(true);
  }
}


           
         
    
    
  








Related examples in the same category

1.Color.GRAY
2.Color.magenta
3.Color.pink
4.new Color(int r, int g, int b)
5.new Color(int rgb)
6.Color: equals(Object obj)
7.Color: getComponents(float[] compArray)
8.Color: getRGB()
9.Color: HSBtoRGB(float hue,float saturation,float brightness)
10.Color: RGBtoHSB(int r, int g, int b, float[] hsbvals)