Java Swing Tutorial - Java Color DARK_GRAY








Syntax

Color.DARK_GRAY has the following syntax.

public static final Color DARK_GRAY

Example

In the following code shows how to use Color.DARK_GRAY field.

import java.awt.Color;
/*from  www. j  a  v  a2s  .  co m*/
import javax.swing.JFrame;
import javax.swing.JLabel;

public class Main {
  public static void main(String[] args) {
    JLabel label = new JLabel("First Name");
    label.setForeground(Color.DARK_GRAY);

    
    
    JFrame frame = new JFrame();
    frame.add(label);
    frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
    frame.setBounds(20,20, 500,500);
    frame.setVisible(true);
  }
}