Java Swing Tutorial - Java Color .getRGBComponents (float[] compArray)








Syntax

Color.getRGBComponents(float[] compArray) has the following syntax.

public float[] getRGBComponents(float[] compArray)

Example

In the following code shows how to use Color.getRGBComponents(float[] compArray) method.

// w  w w .j ava2  s . c o  m
import java.awt.Color;
import java.util.Arrays;

public class Main {
  public static void main(String[] args) {

    Color myColor = Color.RED;          

    System.out.println(Arrays.toString(myColor.getRGBComponents(null)));
    
  }
}

The code above generates the following result.