Some swing components such as text fields have built in support for copy and 
paste.
But if you want to add such support for a component that doesn't, then one of 
the things you might want to do is support standard keyboard shortcuts.
Luckily, there's a tutorial for doing this kind of thing, let's see how they do 
it:
https://docs.oracle.com/javase/tutorial/uiswing/dnd/listpaste.html
Uh oh...
getKeyStroke("ctrl V")
The tutorial simply hardcodes the relevant shortcuts.
I suspect that this works fine on windows, and will lead Mac users to grumble.
Is there a way to ask Java would the right keyboard shortcut should be?
I suppose one could always create a scratch text field just to look through its 
input map, but seems a bit hacky.

This message is for information purposes only. It is not a recommendation, 
advice, offer or solicitation to buy or sell a product or service, nor an 
official confirmation of any transaction. It is directed at persons who are 
professionals and is intended for the recipient(s) only. It is not directed at 
retail customers. This message is subject to the terms at: 
https://www.cib.barclays/disclosures/web-and-email-disclaimer.html. 

For important disclosures, please see: 
https://www.cib.barclays/disclosures/sales-and-trading-disclaimer.html 
regarding marketing commentary from Barclays Sales and/or Trading desks, who 
are active market participants; 
https://www.cib.barclays/disclosures/barclays-global-markets-disclosures.html 
regarding our standard terms for Barclays Corporate and Investment Bank where 
we trade with you in principal-to-principal wholesale markets transactions; and 
in respect to Barclays Research, including disclosures relating to specific 
issuers, see: http://publicresearch.barclays.com.
__________________________________________________________________________________
 
If you are incorporated or operating in Australia, read these important 
disclosures: 
https://www.cib.barclays/disclosures/important-disclosures-asia-pacific.html.
__________________________________________________________________________________
For more details about how we use personal information, see our privacy notice: 
https://www.cib.barclays/disclosures/personal-information-use.html. 
__________________________________________________________________________________

Reply via email to