com.tulskiy.keymaster.common.HotKeyListener Java Examples

The following examples show how to use com.tulskiy.keymaster.common.HotKeyListener. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GlobalHotkey.java    From HubTurbo with GNU Lesser General Public License v3.0 5 votes vote down vote up
public void init() {
    provider.register(KeyStroke.getKeyStroke(GLOBAL_HOTKEY), new HotKeyListener() {
        public void onHotKey(HotKey hotKey) {
            if (!ui.isWindowMinimized() && ui.isWindowFocused()) {
                Platform.runLater(() -> ui.minimizeWindow());
                ui.getBrowserComponent().minimizeWindow();
            } else {
                Platform.runLater(() -> ui.setDefaultWidth());
                ui.getBrowserComponent().focus(ui.getMainWindowHandle());
            }
        }
    });
}
 
Example #2
Source File: WindowsProvider.java    From SikuliX1 with MIT License 4 votes vote down vote up
public void register(KeyStroke keyCode, HotKeyListener listener) {
    synchronized (lock) {
        registerQueue.add(new HotKey(keyCode, listener));
    }
}
 
Example #3
Source File: WindowsProvider.java    From SikuliX1 with MIT License 4 votes vote down vote up
public void register(MediaKey mediaKey, HotKeyListener listener) {
    synchronized (lock) {
        registerQueue.add(new HotKey(mediaKey, listener));
    }
}
 
Example #4
Source File: CarbonProvider.java    From SikuliX1 with MIT License 4 votes vote down vote up
public void register(KeyStroke keyCode, HotKeyListener listener) {
    synchronized (lock) {
        registerQueue.add(new OSXHotKey(keyCode, listener));
        lock.notify();
    }
}
 
Example #5
Source File: CarbonProvider.java    From SikuliX1 with MIT License 4 votes vote down vote up
public void register(MediaKey mediaKey, HotKeyListener listener) {
    //LOGGER.warn("Media keys are not supported on this platform");
}
 
Example #6
Source File: CarbonProvider.java    From SikuliX1 with MIT License 4 votes vote down vote up
public OSXHotKey(KeyStroke keyStroke, HotKeyListener listener) {
    super(keyStroke, listener);
}
 
Example #7
Source File: X11Provider.java    From SikuliX1 with MIT License 4 votes vote down vote up
public void register(KeyStroke keyCode, HotKeyListener listener) {
    synchronized (lock) {
        registerQueue.add(new X11HotKey(keyCode, listener));
    }
}
 
Example #8
Source File: X11Provider.java    From SikuliX1 with MIT License 4 votes vote down vote up
public void register(MediaKey mediaKey, HotKeyListener listener) {
    synchronized (lock) {
        registerQueue.add(new X11HotKey(mediaKey, listener));
    }
}
 
Example #9
Source File: X11Provider.java    From SikuliX1 with MIT License 4 votes vote down vote up
X11HotKey(KeyStroke keyStroke, HotKeyListener listener) {
    super(keyStroke, listener);
}
 
Example #10
Source File: X11Provider.java    From SikuliX1 with MIT License 4 votes vote down vote up
X11HotKey(MediaKey mediaKey, HotKeyListener listener) {
    super(mediaKey, listener);
}
 
Example #11
Source File: ScreenStudio.java    From screenstudio with GNU General Public License v3.0 4 votes vote down vote up
/**
 * Creates new form MainVersion3
 */
public ScreenStudio() {
    initComponents();

    this.setIconImage(new ImageIcon(ScreenStudio.class.getResource("/screenstudio/gui/images/icon.png")).getImage());
    initControls();
    updateColumnsLayout();
    mLayoutPreview = new SourceLayoutPreview(tableSources, mSources);
    mLayoutPreview.setOutputWidth((Integer) spinWidth.getValue());
    mLayoutPreview.setOutputHeight((Integer) spinHeight.getValue());
    panPreviewLayout.add(mLayoutPreview, BorderLayout.CENTER);
    this.setTitle("ScreenStudio " + screenstudio.Version.MAIN);
    //this.setSize(700, 500);
    this.pack();
    ToolTipManager.sharedInstance().setDismissDelay(8000);
    ToolTipManager.sharedInstance().setInitialDelay(2000);
    new Thread(() -> {
        if (Version.hasNewVersion()) {
            lblMessages.setText(LANGUAGES.getString("MSG_NEW_VERSION_AVAILABLE"));
        }
        String text = "";
        for (String msg : SystemCheck.getSystemCheck(false)) {
            text = text + msg + "\n ";
        }
        if (text.length() > 0) {
            lblMessages.setText(text);
            lblMessages.setForeground(Color.red);
            lblMessages.setToolTipText("<HTML><BODY>" + text.replaceAll("\n", "<BR>") + "</BODY></HTML>");
        }
    }).start();
    mShortcuts = Provider.getCurrentProvider(false);
    mShortcuts.register(KeyStroke.getKeyStroke("control shift R"), new HotKeyListener() {
        @Override
        public void onHotKey(HotKey hotkey) {
            System.out.println("Hotkey: " + hotkey.toString());
            switch (hotkey.keyStroke.getKeyCode()) {
                case KeyEvent.VK_R:
                    mnuCapture.doClick();
                    break;
            }
        }
    });
    mRemote = new HTTPServer(null, null, mnuCapture);
    new Thread(mRemote).start();
    try {
        lblRemoteMessage.setText(LANGUAGES.getString("REMOTE_ACCESS") + ": http://" + Inet4Address.getLocalHost().getHostName() + ".local:" + mRemote.getPort());
    } catch (UnknownHostException ex) {
        Logger.getLogger(ScreenStudio.class.getName()).log(Level.SEVERE, null, ex);
    }
}