Java Swing Tutorial - Java Color.getRed()








Syntax

Color.getRed() has the following syntax.

public int getRed()

Example

In the following code shows how to use Color.getRed() method.

//from   w w w  .  j  av a  2  s.c  o m
import java.awt.Color;

public class Main {
  public static void main(String[] args) {
    Color myColor = Color.RED;          

    System.out.println(myColor.getRed());
    
  }
}

The code above generates the following result.