Using your approach, you need to make the field accessible first:
f.setAccessible(true);
But there also is an issue with the way you try to get the field. The example below works fine and you can adapt as required:
public static void main(String[] args) {
Map<Object, String> map = new HashMap<>();
for (Field f : KeyEvent.class.getDeclaredFields()) {
try {
if (java.lang.reflect.Modifier.isStatic(f.getModifiers())) {
f.setAccessible(true);
map.put(f.get(null), f.getName());
}
} catch (IllegalArgumentException | IllegalAccessException ex) {
ex.printStackTrace();
}
}
System.out.println(map);
}