Color (final Class aClass, final String fieldName) { try { final Field field = aClass.getDeclaredField(fieldName); return (Color)field.get(null); } catch (NoSuchFieldException | IllegalAccessException e) { return Color.black; } }