• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HotKey类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中com.tulskiy.keymaster.common.HotKey的典型用法代码示例。如果您正苦于以下问题:Java HotKey类的具体用法?Java HotKey怎么用?Java HotKey使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



HotKey类属于com.tulskiy.keymaster.common包,在下文中一共展示了HotKey类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: main

import com.tulskiy.keymaster.common.HotKey; //导入依赖的package包/类
public static void main(String[] args) {
    final Provider provider = Provider.getCurrentProvider(false);
    Runtime.getRuntime().addShutdownHook(new Thread("shutdown-hook") {
        @Override
        public void run() {
            provider.reset();
            provider.stop();
        }
    });
    provider.register(MediaKey.MEDIA_PLAY_PAUSE, new HotKeyListener() {
        @Override
        public void onHotKey(HotKey hotKey) {
            System.err.println("hotkey received" + hotKey);
        }
    });
}
 
开发者ID:groovejames,项目名称:groovejames,代码行数:17,代码来源:JKeymasterTest.java


示例2: initShortcuts

import com.tulskiy.keymaster.common.HotKey; //导入依赖的package包/类
private void initShortcuts() {
    // Global shortcut: Reload GUI with Ctrl-R
    window.getActionMappings().add(new Window.ActionMapping(
        new Keyboard.KeyStroke(Keyboard.KeyCode.R, Platform.getCommandModifier().getMask()),
        "reloadGUI"));
    // Global shortcut: Close currently active tab with Ctrl-W
    window.getActionMappings().add(new Window.ActionMapping(
        new Keyboard.KeyStroke(Keyboard.KeyCode.W, Platform.getCommandModifier().getMask()),
        "closeCurrentTab"));
    // Global shortcut: Close all tabs with Ctrl-Shift-W
    window.getActionMappings().add(new Window.ActionMapping(
        new Keyboard.KeyStroke(Keyboard.KeyCode.W, Platform.getCommandModifier().getMask() + Keyboard.Modifier.SHIFT.getMask()),
        "closeAllTabs"));
    // Desktop-wide hotkey: Pause/Resume with media key (if available and supported on current platform)
    provider = Provider.getCurrentProvider(false);
    if (provider != null) {
        HotKeyListener hotKeyListener = new HotKeyListener() {
            @Override
            public void onHotKey(HotKey hotKey) {
                log.debug("hotkey received: " + hotKey);
                Services.getPlayService().pauseOrResume();
            }
        };
        provider.register(MediaKey.MEDIA_PLAY_PAUSE, hotKeyListener);
        provider.register(KeyStroke.getKeyStroke(KeyEvent.VK_P, InputEvent.META_DOWN_MASK + InputEvent.SHIFT_DOWN_MASK), hotKeyListener);
        log.info("Registered global hotkeys MEDIA_PLAY_PAUSE and Win-Shift-P");
    } else {
        log.warn("No support for global hotkeys on this platform (detected: " + ARCH + "; os-type " + getOSType());
    }
}
 
开发者ID:groovejames,项目名称:groovejames,代码行数:31,代码来源:Main.java


示例3: registerClearHotKey

import com.tulskiy.keymaster.common.HotKey; //导入依赖的package包/类
private void registerClearHotKey() {
    provider = Provider.getCurrentProvider(true);
    provider.register(KeyStroke.getKeyStroke("shift meta C"), new HotKeyListener() {
        public void onHotKey(HotKey hotKey) {
            UI.this.clearPackagedEvent();
        }
    });
}
 
开发者ID:xumc,项目名称:easy_db_checker,代码行数:9,代码来源:UI.java


示例4: init

import com.tulskiy.keymaster.common.HotKey; //导入依赖的package包/类
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());
            }
        }
    });
}
 
开发者ID:HubTurbo,项目名称:HubTurbo,代码行数:14,代码来源:GlobalHotkey.java


示例5: MicrophoneStatus

import com.tulskiy.keymaster.common.HotKey; //导入依赖的package包/类
public MicrophoneStatus(int delay, boolean guiDisplay) {
    if (!SystemTray.isSupported()) {
        System.err.println("System Tray is not supported!");
        System.exit(1);
    }

    this.delay = delay;
    this.guiDisplay = guiDisplay;

    this.provider = Provider.getCurrentProvider(true);
    this.provider.register(KeyStroke.getKeyStroke("ctrl alt B"), new HotKeyListener() {
        @Override
        public void onHotKey(HotKey hotKey) {
            toggleMuteStatus();
        }
    });

    if (microphones.length == 1) {
        microphoneToUse = microphones[0];
    } else if (microphones.length > 1) {
        microphoneToUse = (String) JOptionPane.showInputDialog(new JFrame(), "Select a microphone to use",
                "Select a microphone to use", JOptionPane.QUESTION_MESSAGE, null, microphones, microphones[0]);
    }

    if (microphoneToUse == null) {
        JOptionPane.showMessageDialog(null, "Couldn't find a microphone to use!", "Error", JOptionPane
                .ERROR_MESSAGE);
        System.exit(1);
    }

    setupMicrophone(microphoneToUse);

    initComponents();
}
 
开发者ID:RyanTheAllmighty,项目名称:Twitch-Tools,代码行数:35,代码来源:MicrophoneStatus.java


示例6: ScreenStudio

import com.tulskiy.keymaster.common.HotKey; //导入依赖的package包/类
/**
 * 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);
    }
}
 
开发者ID:patrickballeux,项目名称:screenstudio,代码行数:53,代码来源:ScreenStudio.java


示例7: onHotKey

import com.tulskiy.keymaster.common.HotKey; //导入依赖的package包/类
@Override
public void onHotKey(HotKey hotKey) {
  callback.hotkeyPressed(new HotkeyEvent(key, modifier));
}
 
开发者ID:RaiMan,项目名称:SikuliX2,代码行数:5,代码来源:HotkeyManager.java


示例8: onHotKey

import com.tulskiy.keymaster.common.HotKey; //导入依赖的package包/类
@Override
public void onHotKey(HotKey hotKey) {
    player.stop();
}
 
开发者ID:eguller,项目名称:MouseRecorder,代码行数:5,代码来源:StopHotKeyListener.java



注:本文中的com.tulskiy.keymaster.common.HotKey类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java FileDownloadLog类代码示例发布时间:2022-05-23
下一篇:
Java FilterExecutor类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap