I am trying to use the UIManager to get and clear some default key bindings so that the spacebar doesn’t activate my JButtons, as explained here. Problem is, likely due to my synth look and feel, (InputMap)UIManager.get("Button.focusInputMap"); returns a null. Does anyone know of a way to easily clear components input maps some other way, or why the UIManager returns a null in this case? Any tips are appreciated, thanks beforehand.
I am trying to use the UIManager to get and clear some default key
Share
I’m not near a computer to try this, but looking at the openjdk 7 source here, the mapping looks fixed by default.
A possible, but slightly hacky, solution could be to create and install a decorator SynthStyleFactory that modifies the style prior to returning it.
EDIT:
I’ve updated the below code sample as I’ve had a chance to test this. It didn’t work in it’s original form, but the updated code worked for me.
EDIT:
I don’t seem able to add a comment to the original post, so
just to clarify, I had confirmed that UIManager.get(“Button.focusInputMap”) returned null with just plain Synth, prior to creating any components. Possibly Nimbus is overriding this behaviour.