Answers for "get color from name java"

1

java get color from string

Color color;
try {
    Field field = Class.forName("java.awt.Color").getField("yellow");
    color = (Color)field.get(null);
} catch (Exception e) {
    color = null; // Not defined
}
Posted by: Guest on August-27-2021

Code answers related to "get color from name java"

Code answers related to "Java"

Java Answers by Framework

Browse Popular Code Answers by Language