本文整理汇总了Java中com.apple.eawt.event.GestureUtilities.addGestureListenerTo方法的典型用法代码示例。如果您正苦于以下问题:Java GestureUtilities.addGestureListenerTo方法的具体用法?Java GestureUtilities.addGestureListenerTo怎么用?Java GestureUtilities.addGestureListenerTo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.apple.eawt.event.GestureUtilities
的用法示例。
在下文中一共展示了GestureUtilities.addGestureListenerTo方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: MacGestureSupportForMouseShortcutPanel
import com.apple.eawt.event.GestureUtilities; //导入方法依赖的package包/类
public MacGestureSupportForMouseShortcutPanel(MouseShortcutPanel panel, Runnable runnable) {
GestureListener pressureListener = new PressureListener() {
@Override
public void pressure(PressureEvent e) {
if (e.getStage() == 2) {
panel.setShortcut(new PressureShortcut(e.getStage()));
runnable.run();
}
}
};
GestureUtilities.addGestureListenerTo(panel, pressureListener);
}
示例2: MacGestureSupportForEditor
import com.apple.eawt.event.GestureUtilities; //导入方法依赖的package包/类
public MacGestureSupportForEditor(JComponent component) {
GestureUtilities.addGestureListenerTo(component, new PressureListener() {
@Override
public void pressure(PressureEvent e) {
if (IdeMouseEventDispatcher.isForceTouchAllowed() && e.getStage() == 2) {
MouseShortcut shortcut = new PressureShortcut(e.getStage());
fillActionsList(shortcut, IdeKeyEventDispatcher.isModalContext(component));
ActionManagerEx actionManager = ActionManagerEx.getInstanceEx();
if (actionManager != null) {
AnAction[] actions = myActions.toArray(new AnAction[myActions.size()]);
for (AnAction action : actions) {
DataContext dataContext = DataManager.getInstance().getDataContext(component);
Presentation presentation = myPresentationFactory.getPresentation(action);
AnActionEvent actionEvent = new AnActionEvent(null, dataContext, ActionPlaces.MAIN_MENU, presentation,
ActionManager.getInstance(),
0);
action.beforeActionPerformedUpdate(actionEvent);
if (presentation.isEnabled()) {
actionManager.fireBeforeActionPerformed(action, dataContext, actionEvent);
final Component context = dataContext.getData(PlatformDataKeys.CONTEXT_COMPONENT);
if (context != null && !context.isShowing()) continue;
action.actionPerformed(actionEvent);
}
}
}
e.consume();
IdeMouseEventDispatcher.forbidForceTouch();
}
}
});
}