Java Swing Tutorial - Java Color.getColor(String nm)








Syntax

Color.getColor(String nm) has the following syntax.

public static Color getColor(String nm)

Example

In the following code shows how to use Color.getColor(String nm) method.

import java.awt.Color;
/*from   ww  w.  j  a v  a 2s . c  om*/
public class Main {
  public static void main(String[] args) {
    System.setProperty("myColor", "0XFFFFFF");
    Color myColor = Color.getColor("myColor");          

    System.out.println(myColor);
    
  }
}

The code above generates the following result.