Java Swing Tutorial - Java Color.getTransparency()








Syntax

Color.getTransparency() has the following syntax.

public int getTransparency()

Example

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

import java.awt.Color;
//from  w  w  w .  ja  va  2  s.com
public class Main {
  public static void main(String[] args) {
    Color myColor = Color.RED;          

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

The code above generates the following result.