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






Color.GRAY

   

import java.awt.Color;
import java.awt.FlowLayout;
import java.awt.Font;

import javax.swing.JFrame;
import javax.swing.JLabel;

public class Main {
  public static void main(String[] args) {
    JFrame.setDefaultLookAndFeelDecorated(true);
    JFrame frame = new JFrame();
    frame.setTitle("JLabel Test");
    frame.setLayout(new FlowLayout());
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    JLabel label = new JLabel("First Name");
    label.setFont(new Font("Courier New", Font.ITALIC, 12));
    label.setForeground(Color.GRAY);

    frame.add(label);
    frame.pack();
    frame.setVisible(true);
  }
}

   
    
    
  








Related examples in the same category

1.Color.lightGray
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)