Java Swing Tutorial - Java Color.getGreen()








Syntax

Color.getGreen() has the following syntax.

public int getGreen()

Example

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

import java.awt.Color;
//w w w  .  j  av  a2s  .co m
public class Main {
  public static void main(String[] args) {
    Color myColor = Color.RED;          

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

The code above generates the following result.