What does putValue(MNEMONIC_KEY, KeyEvent.VK_S) do?

what the putValue exactly does

It just sets a property of the Action.

Read the section from the Swing tutorial on How to Use Actions for more information and a list of all the properties.

When you add an Action to a Swing component (JButton, JMenuItem etc), The the properties of the Action are used to configure the component. So the same “text” can be used on all components, the “enabled” state will be the same for all components etc.

In the case of the mnemonic property a Key Binding will be set up automatically so that you can invoke the Action when the KeyStroke is used. Read the section from the Swing tutorial on Key Bindings

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top