Java Swing Tutorial - Java Color.getAlpha()








Syntax

Color.getAlpha() has the following syntax.

public int getAlpha()

Example

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

import java.awt.Color;
/*w  w w . j ava2 s  .c o m*/
public class Main {
  public static void main(String[] args) {
    Color myColor = Color.RED;          

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

The code above generates the following result.