當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。