本文整理汇总了Java中com.tulskiy.keymaster.common.Provider类的典型用法代码示例。如果您正苦于以下问题:Java Provider类的具体用法?Java Provider怎么用?Java Provider使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Provider类属于com.tulskiy.keymaster.common包,在下文中一共展示了Provider类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: main
import com.tulskiy.keymaster.common.Provider; //导入依赖的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.Provider; //导入依赖的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.Provider; //导入依赖的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: registerGlobalHotkeys
import com.tulskiy.keymaster.common.Provider; //导入依赖的package包/类
private void registerGlobalHotkeys() {
Provider provider = Provider.getCurrentProvider(true);
provider.register(KeyStroke.getKeyStroke("control PRINTSCREEN"), key ->{
captureScreen(null);
});
}
开发者ID:kciray8,项目名称:IronBrain,代码行数:8,代码来源:Main.java
示例5: MicrophoneStatus
import com.tulskiy.keymaster.common.Provider; //导入依赖的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.Provider; //导入依赖的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: initProvider
import com.tulskiy.keymaster.common.Provider; //导入依赖的package包/类
private void initProvider() {
if (SX.isNull(hotkeyProvider)) {
hotkeyProvider = Provider.getCurrentProvider(false);
}
}
开发者ID:RaiMan,项目名称:SikuliX2,代码行数:6,代码来源:HotkeyManager.java
示例8: register
import com.tulskiy.keymaster.common.Provider; //导入依赖的package包/类
public void register() {
provider = Provider.getCurrentProvider(true);
provider.register(KeyStroke.getKeyStroke(STOP_HOTKEY), this);
}
开发者ID:eguller,项目名称:MouseRecorder,代码行数:5,代码来源:StopHotKeyListener.java
注:本文中的com.tulskiy.keymaster.common.Provider类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论