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








Syntax

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

public float[] getComponents(float[] compArray)

Example

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

/*from  w ww .jav  a  2s .co  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.getComponents(null)));
    
  }
}

The code above generates the following result.