Add a global shortcut to Java

xiaoxiao2021-03-06  67

Occasionally, we can add some shortcuts to the user, no matter where the focus is. There is a way to register your listener on any set, but obviously, this is not a good practice Java's Toolkit to add a listener directly. That is the example Toolkit Toolkit = Toolkit.GetDefaultToolkit (); Toolkit.AddawteventListener (Caplistener, AWTEvent.KEY_EVENT_MASK | AWTEvent.MOUSE_EVENT_MASK | AWTEvent.WINDOW_EVENT_MASK); implement a listener: class CapListener implements AWTEventListener {public void eventDispatched (AWTEvent event) {}} This allows the

转载请注明原文地址:https://www.9cbs.com/read-89681.html

New Post(0)