Package-level declarations

Functions

Link copied to clipboard

Installs a KeyListener whose every event is forwarded to onKeyEvent.

Link copied to clipboard
fun SwingModifier.onKeyStroke(keyStroke: KeyStroke, condition: Int = JComponent.WHEN_FOCUSED, onAction: () -> Unit): SwingModifier

Binds a single KeyStroke to onAction via the component's InputMap/ActionMap - the idiomatic Swing path for shortcuts. condition selects the focus scope (a FocusCondition JComponent.WHEN_* value) and defaults to JComponent.WHEN_FOCUSED.

fun SwingModifier.onKeyStroke(keyStroke: String, condition: Int = JComponent.WHEN_FOCUSED, onAction: () -> Unit): SwingModifier

Convenience overload of onKeyStroke that parses keyStroke via KeyStroke.getKeyStroke(String) (e.g. "ctrl S", "meta shift Z"). Throws at install if the string is not a valid key-stroke descriptor.