Is there a way to programmatically press javax.swing button on keyPressed, and release on keyReleased?

26 Views Asked by At

I don't want doClick(), because I want the button to look pressed in while the user is pressing a key, and I want the button to release when the user releases the key. I don't want setMnemonic(int mnemonic) because I don't want the user to have to press the alt key to activate it. If I have to modify the look and feel's mouseless modifier, okay then, but I'm still not sure how to do that. I swore there used to be a method called setPressed(boolean pressed), maybe it was removed... But anyways, how do I programmatically press or release javax.swing button?

0

There are 0 best solutions below