当前位置: 首页>>代码示例>>Java>>正文


Java MouseEventAdapter类代码示例

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


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

示例1: mousePressed

import com.intellij.util.ui.MouseEventAdapter; //导入依赖的package包/类
@Override
public void mousePressed(MouseEvent e) {
  Component c = e.getComponent();
  if (c instanceof IdeMenuBar) {
    Dimension size = c.getSize();
    Insets insets = ((IdeMenuBar)c).getInsets();
    Point p = e.getPoint();
    if (p.y < insets.top || p.y >= size.height - insets.bottom) {
      Component item = ((IdeMenuBar)c).findComponentAt(p.x, size.height / 2);
      if (item instanceof JMenuItem) {
        // re-target border clicks as a menu item ones
        item.dispatchEvent(MouseEventAdapter.convert(e, item, 1, 1));
        e.consume();
        return;
      }
    }
  }

  super.mouseClicked(e);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:IdeMenuBar.java

示例2: createArrow

import com.intellij.util.ui.MouseEventAdapter; //导入依赖的package包/类
private static JLabel createArrow(final ActionLink link) {
  JLabel arrow = new JLabel(AllIcons.General.Combo3);
  arrow.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  arrow.setVerticalAlignment(SwingConstants.BOTTOM);
  new ClickListener() {
    @Override
    public boolean onClick(@NotNull MouseEvent e, int clickCount) {
      final MouseEvent newEvent = MouseEventAdapter.convert(e, link, e.getX(), e.getY());
      link.doClick(newEvent);
      return true;
    }
  }.installOn(arrow);
  return arrow;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:FlatWelcomeFrame.java

示例3: dispatchEvent

import com.intellij.util.ui.MouseEventAdapter; //导入依赖的package包/类
private static void dispatchEvent(JComponent component, MouseEvent event) {
  if (component != null && event != null) {
    Point point = event.getLocationOnScreen();
    SwingUtilities.convertPointFromScreen(point, component);
    component.dispatchEvent(MouseEventAdapter.convert(event, component, point.x, point.y));
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:AbstractExpandableItemsHandler.java

示例4: changeSourceIfNeeded

import com.intellij.util.ui.MouseEventAdapter; //导入依赖的package包/类
private static AWTEvent changeSourceIfNeeded(AWTEvent awtEvent) {
  if (SystemInfo.isMac && Registry.is("ide.inertial.mouse.fix") && awtEvent instanceof MouseWheelEvent) {
    MouseWheelEvent mwe = (MouseWheelEvent) awtEvent;
    if (mwe.getWhen() - lastMouseWheel > MOUSE_WHEEL_RESTART_THRESHOLD) {
      wheelDestinationComponent = SwingUtilities.getDeepestComponentAt(mwe.getComponent(), mwe.getX(), mwe.getY());
    }
    lastMouseWheel = System.currentTimeMillis();

    int modifiers = mwe.getModifiers() | mwe.getModifiersEx();
    return MouseEventAdapter.convert(mwe, wheelDestinationComponent, mwe.getID(), lastMouseWheel, modifiers, mwe.getX(), mwe.getY());
  }
  return awtEvent;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:IdeEventQueue.java

示例5: createArrow

import com.intellij.util.ui.MouseEventAdapter; //导入依赖的package包/类
public static JLabel createArrow(final ActionLink link) {
  JLabel arrow = new JLabel(AllIcons.General.Combo3);
  arrow.setCursor(Cursor.getPredefinedCursor(Cursor.HAND_CURSOR));
  arrow.setVerticalAlignment(SwingConstants.BOTTOM);
  new ClickListener() {
    @Override
    public boolean onClick(@Nonnull MouseEvent e, int clickCount) {
      final MouseEvent newEvent = MouseEventAdapter.convert(e, link, e.getX(), e.getY());
      link.doClick(newEvent);
      return true;
    }
  }.installOn(arrow);
  return arrow;
}
 
开发者ID:consulo,项目名称:consulo,代码行数:15,代码来源:FlatWelcomePanel.java

示例6: convertEvent

import com.intellij.util.ui.MouseEventAdapter; //导入依赖的package包/类
private static MouseEvent convertEvent(final MouseEvent e, final Component target) {
  final Point point = SwingUtilities.convertPoint(e.getComponent(), e.getPoint(), target);
  return MouseEventAdapter.convert(e, target, point.x, point.y);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:5,代码来源:IdeGlassPaneImpl.java


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