awt – Getting a view for a keyboard shortcut

Question:

Let's say I have a control in my application that has some KeyStroke . And it automatically sets ToolTip depending on the system. For example, on Windows it is text like Ctrl+Shift+Z , and on MacOS it is ⌘⇧Z . How to get this string for a given keyboard shortcut?

PS
Interested in getting a given string as with AWT (or Swing).

Answer:

Looking towards KeyEvent.getKeyModifiersText ,KeyEvent.getKeyText and KeyEvent.getKeyModifiersExText

Scroll to Top