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


Java MouseEvent.isMetaDown方法代码示例

本文整理汇总了Java中java.awt.event.MouseEvent.isMetaDown方法的典型用法代码示例。如果您正苦于以下问题:Java MouseEvent.isMetaDown方法的具体用法?Java MouseEvent.isMetaDown怎么用?Java MouseEvent.isMetaDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在java.awt.event.MouseEvent的用法示例。


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

示例1: mouseClicked

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent event) {

      if ((event.isMetaDown() || event.isShiftDown()) && panelType != TICKS_VALMAX) {
        new EditTickLabelValueDialog(this);
        return;
      }
      int col = Math.min((event.getX() - leftMargin + 1) / dx, numCols - 1);
      int row = Math.min((event.getY() - topMargin + 1) / dx, numRows - 1);
      int num = row * numCols + col + 1;

      // Checkbox behavior; toggle the box clicked on
      // numTicks = num > numTicks ? num : num - 1;

      // Slider behavior; set the box clicked on and all to left and clear all boxes to right,
      // UNLESS user clicked on last set box (which would do nothing), in this case, toggle the
      // box clicked on.  This is the only way the user can clear the first box.

      numTicks = (num == numTicks) ? num - 1 : num;
      fireActionEvent();

      repaint();
    }
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:23,代码来源:PropertySheet.java

示例2: mouseClicked

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {
  final Point p = e.getPoint();
  lastClick = p;

  if (e.isMetaDown()) { // Right click...menu
    doPopupMenu(e);
  }
  else if (lastClickedRegion != null) {

    if (e.getClickCount() >= 2) { // Double click show properties
      if (lastClickedRegion.getConfigurer() != null) {
        final Action a =
          new EditPropertiesAction(lastClickedRegion, null, this);
        if (a != null) {
          a.actionPerformed(
              new ActionEvent(
                  e.getSource(),
                  ActionEvent.ACTION_PERFORMED,
                  "Edit")); //$NON-NLS-1$
        }
      }
    }

  }
  view.repaint(); // Clean up selection
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:27,代码来源:RegionGrid.java

示例3: mouseDragged

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseDragged(MouseEvent e) {
  if (!e.isMetaDown()) {
    scrollAtEdge(e.getPoint(), 15);
  }

  if (selectionRect != null) {
    // FIXME: inefficient, could be done with only one new Rectangle
    final Rectangle repaintRect =
      new Rectangle(selectionRect.x-1, selectionRect.y-1,
                    selectionRect.width+3, selectionRect.height+3);

    selectionRect.x = Math.min(e.getX(), anchor.x);
    selectionRect.y = Math.min(e.getY(), anchor.y);
    selectionRect.width = Math.abs(e.getX() - anchor.x);
    selectionRect.height = Math.abs(e.getY() - anchor.y);

    repaintRect.add(
      new Rectangle(selectionRect.x-1, selectionRect.y-1,
                    selectionRect.width+3, selectionRect.height+3));
    view.repaint(repaintRect);
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:23,代码来源:RegionGrid.java

示例4: mousePressed

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mousePressed(MouseEvent e) {
  selected = -1;
  double minDist = Float.MAX_VALUE;
  for (int i = 0; i < polygon.npoints; ++i) {
    double dist = Point2D.distance(polygon.xpoints[i], polygon.ypoints[i], e.getX(), e.getY());
    if (dist < minDist) {
      minDist = dist;
      selected = i;
    }
  }
  if (e.isMetaDown()) {
    polygon.addPoint(e.getX(), e.getY());
    if (selected >= 0) {
      for (int i = polygon.npoints - 1; i > selected; --i) {
        polygon.xpoints[i] = polygon.xpoints[i - 1];
        polygon.ypoints[i] = polygon.ypoints[i - 1];
      }
      polygon.xpoints[selected] = e.getX();
      polygon.ypoints[selected] = e.getY();
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:23,代码来源:PolygonEditor.java

示例5: mouseReleased

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseReleased(MouseEvent e) {
  if (e.isMetaDown()) {
    GamePiece found = map.findPiece(e.getPoint(), finder);
    if (found != null) {
      EventFilter filter = (EventFilter) found.getProperty(Properties.SELECT_EVENT_FILTER);
      if (filter != null
          && filter.rejectEvent(e)) {
        found = null;
      }
    }
    if (found == null) {
      Map.View m = (Map.View) e.getSource();
      m.getMap().centerAt(e.getPoint());
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:17,代码来源:MapCenterer.java

示例6: mousePressed

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mousePressed(MouseEvent event) {
  if (event.isMetaDown()) {
    final JPopupMenu popup = new JPopupMenu();
    final JMenuItem item = new JMenuItem("Return to default page");

    item.addActionListener(new ActionListener() {
      // Return to default page
      public void actionPerformed(ActionEvent e) {
        setFile(fileName);
      }
    });

    popup.add(item);
    if (event.getComponent().isShowing()) {
      popup.show(event.getComponent(), event.getX(), event.getY());
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:19,代码来源:HtmlChart.java

示例7: mousePressed

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/** {@inheritDoc} */
@Override
public void mousePressed(MouseEvent e, Point imageLocation) {

    double pX = (double) imageLocation.x / (double) getCanvas().getCanvasImage().getWidth();
    double pY = (double) imageLocation.y / (double) getCanvas().getCanvasImage().getHeight();

    if (e.isControlDown() || e.isAltDown() || e.isMetaDown()) {
        reset();
    }

    else if (e.isShiftDown()) {
        zoomOut(e.getX(), e.getY());
        getCanvas().setScrollPosition(pX, pY);
    }

    else {
        zoomIn();
        getCanvas().setScrollPosition(pX, pY);
    }
}
 
开发者ID:defano,项目名称:jmonet,代码行数:22,代码来源:MagnifierTool.java

示例8: mouseClicked

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
@Override
public void mouseClicked(MouseEvent event)
{
   int xPos = event.getX(); // get x-position of mouse
   int yPos = event.getY(); // get y-position of mouse

   details = String.format("Clicked %d time(s)", 
      event.getClickCount());

   if (event.isMetaDown()) // right mouse button   
      details += " with right mouse button";
   else if (event.isAltDown()) // middle mouse button
      details += " with center mouse button";
   else // left mouse button                       
      details += " with left mouse button";

   statusBar.setText(details); 
}
 
开发者ID:cleitonferreira,项目名称:LivroJavaComoProgramar10Edicao,代码行数:19,代码来源:MouseDetailsFrame.java

示例9: mousePressed

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
protected void mousePressed(MouseEvent me) {
    if (me.getButton() == MouseEvent.BUTTON1 && me.getClickCount() == 1 && !me.isAltDown() && !me.isMetaDown()
            && !me.isAltGraphDown() && !me.isControlDown()) {
        mouseButton1Pressed(me);
    } else {
        recorder.recordClick2(this, me, true);
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:9,代码来源:RComponent.java

示例10: canHandleEvent

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
protected boolean canHandleEvent(MouseEvent e) {
  return !e.isShiftDown() &&
         !e.isControlDown() &&
         !e.isMetaDown() &&
          e.getClickCount() < 2 &&
         !e.isConsumed();
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:8,代码来源:PieceMover.java

示例11: mouseDragged

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
 * Mouse motion events are not forwarded to LocalMouseListeners or to
 * listeners on the stack.
 *
 * The map scrolls when dragging the mouse near the edge.
 */
public void mouseDragged(MouseEvent e) {
  if (!e.isMetaDown()) {
    scrollAtEdge(e.getPoint(), SCROLL_ZONE);
  }
  else {
    if (scroller.isRunning()) scroller.stop();
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:15,代码来源:Map.java

示例12: isToggleEvent

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
 * 
 * @param event
 * @return Returns true if the given event should toggle selected cells.
 */
public boolean isToggleEvent(MouseEvent event)
{
	// NOTE: IsMetaDown always returns true for right-clicks on the Mac, so
	// toggle selection for left mouse buttons requires CMD key to be pressed,
	// but toggle for right mouse buttons requires CTRL to be pressed.
	return (event != null) ? ((mxUtils.IS_MAC) ? ((SwingUtilities
			.isLeftMouseButton(event) && event.isMetaDown()) || (SwingUtilities
			.isRightMouseButton(event) && event.isControlDown()))
			: event.isControlDown())
			: false;
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:17,代码来源:mxGraphComponent.java

示例13: isToggleEvent

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
/**
 * 
 * @param event
 * @return Returns true if the given event should toggle selected cells.
 */
public boolean isToggleEvent(MouseEvent event) {
  // NOTE: IsMetaDown always returns true for right-clicks on the Mac, so
  // toggle selection for left mouse buttons requires CMD key to be pressed,
  // but toggle for right mouse buttons requires CTRL to be pressed.
  return (event != null) ? ((mxUtils.IS_MAC)
      ? ((SwingUtilities.isLeftMouseButton(event) && event.isMetaDown())
          || (SwingUtilities.isRightMouseButton(event) && event.isControlDown()))
      : event.isControlDown()) : false;
}
 
开发者ID:ModelWriter,项目名称:Tarski,代码行数:15,代码来源:mxGraphComponent.java

示例14: onlyShift

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
private static boolean onlyShift(MouseEvent e) {
    return e.isShiftDown() && !(e.isAltDown() || e.isAltGraphDown() ||
                                e.isControlDown() || e.isMetaDown());
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:5,代码来源:ProfilerTableContainer.java

示例15: mouseClicked

import java.awt.event.MouseEvent; //导入方法依赖的package包/类
public void mouseClicked(MouseEvent e) {
  if (e.isMetaDown()) {
    doPopup(e.getPoint());
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:6,代码来源:TurnTracker.java


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