One of the reasons for using Key Bindings is to avoid the use of nested if/else statements. Instead you create a unique Action for the key binding, then the action command is irrelevant.
//theDesktop.getActionMap().put("f9ButtonRelease", ClassKeyReleaseHandler);
theDesktop.getActionMap().put("f9ButtonRelease", ScreenShotReleaseHandler);
This is the way all the default Actions are created in Swing.