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


Java Event.CTRL_MASK属性代码示例

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


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

示例1: getMenuShortcutKeyMask

private static int getMenuShortcutKeyMask() {
    // #152050 - work in headless environment too
    try {
        if (!GraphicsEnvironment.isHeadless()) {
            return Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
        }
    } catch (Throwable ex) {
        // OK, just assume we are headless
    }
    return Event.CTRL_MASK;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:11,代码来源:Utilities.java

示例2: getMenuKey

public String getMenuKey() {
    int menuShortcutKeyMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
    if ((menuShortcutKeyMask & Event.CTRL_MASK) == Event.CTRL_MASK) {
        return "Control";
    }
    if ((menuShortcutKeyMask & Event.META_MASK) == Event.META_MASK) {
        return "Meta";
    }
    return "";
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:10,代码来源:JavaElementPropertyAccessor.java

示例3: getMenuKey

public static Keys getMenuKey() {
    int keyMask = Toolkit.getDefaultToolkit().getMenuShortcutKeyMask();
    if (keyMask == Event.CTRL_MASK) {
        return Keys.CONTROL;
    }
    if (keyMask == Event.META_MASK) {
        return Keys.META;
    }
    if (keyMask == Event.ALT_MASK) {
        return Keys.ALT;
    }
    throw new WebDriverException("Unable to find the keymask... not control or meta?");
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:13,代码来源:OSUtils.java

示例4: mousePressed

/*********************************************************************
 * Listen to <code>mousePressed</code> events.
 * Update the current point or call the
 * ImageJ's zoom methods.
 * 
 * @param e
 *            Event.
 ********************************************************************/
@Override
public void mousePressed(final MouseEvent e)
{
	final int x = e.getX();
	final int y = e.getY();
	switch (tb.getCurrentTool())
	{
		case turboRegPointHandler.MAGNIFIER:
		{
			int flags = e.getModifiers();
			if ((flags & (Event.ALT_MASK | Event.META_MASK | Event.CTRL_MASK)) != 0)
			{
				mainImp.getWindow().getCanvas().zoomOut(x, y);
			} else
			{
				mainImp.getWindow().getCanvas().zoomIn(x, y);
			}
			break;
		}
		case turboRegPointHandler.MOVE_CROSS:
		{
			final int currentPoint = mainPh.findClosest(x, y);
			secondaryPh.setCurrentPoint(currentPoint);
			updateAndDraw();
			break;
		}
	}
}
 
开发者ID:TOMIGalway,项目名称:cmoct-sourcecode,代码行数:36,代码来源:ImageAlignTool.java

示例5: getKeyStrokeFor

public static KeyStroke getKeyStrokeFor(char c, List<KeyStroke> usedStrokes) {
	
	int m = Event.CTRL_MASK;
	
	KeyStroke o = null;
	for(Iterator<?> i = usedStrokes.iterator(); i.hasNext();) {
		
		o = (KeyStroke)i.next();
		if(c == o.getKeyChar()) {

			if(c == o.getKeyChar()) {
				
				if(o.getModifiers() != Event.SHIFT_MASK+Event.CTRL_MASK) {
					
					m = Event.SHIFT_MASK+Event.CTRL_MASK;
				}
				else if(o.getModifiers() != Event.SHIFT_MASK+Event.ALT_MASK) {
					
					m = Event.SHIFT_MASK+Event.ALT_MASK;
				}
				else {
					
					m = -1;
				}
			}
		}
	}
	
	KeyStroke s = null;
	if(m != -1) {
		
		s = KeyStroke.getKeyStroke(c, m);
		usedStrokes.add(s);
	}
	
	return s;
}
 
开发者ID:metasfresh,项目名称:metasfresh,代码行数:37,代码来源:SwingTool.java

示例6: keyPressed

/**
 * Gestion des événements clavier sur cette table.
 *
 * @param event
 *           KeyEvent
 */
protected void keyPressed(final KeyEvent event) {
	final int keyCode = event.getKeyCode();
	final int modifiers = event.getModifiers();
	if ((modifiers & Event.CTRL_MASK) != 0 && keyCode == KeyEvent.VK_ADD) {
		adjustColumnWidths();
	}
	// else if (modifiers == 0)
	// {
	// final int selectedColumn = getSelectedColumn() != -1 ? getSelectedColumn() : 0;
	// final int selectedRow = getSelectedRow() != -1 ? getSelectedRow() : 0;
	// final int rowCount = getRowCount();
	// if (isCellEditable(selectedRow, selectedColumn) || rowCount == 0)
	// {
	// return;
	// }
	// final String keyChar = String.valueOf(event.getKeyChar());
	// String text;
	// for (int i = selectedRow + 1; i < rowCount; i++)
	// {
	// text = getTextAt(i, selectedColumn);
	// if (text != null && text.regionMatches(true, 0, keyChar, 0, 1))
	// {
	// setRowSelectionInterval(i, i);
	// setColumnSelectionInterval(selectedColumn, selectedColumn);
	// scrollRectToVisible(getCellRect(i, selectedColumn, true));
	// return;
	// }
	// }
	// for (int i = 0; i <= selectedRow; i++)
	// {
	// text = getTextAt(i, selectedColumn);
	// if (text != null && text.regionMatches(true, 0, keyChar, 0, 1))
	// {
	// setRowSelectionInterval(i, i);
	// setColumnSelectionInterval(selectedColumn, selectedColumn);
	// scrollRectToVisible(getCellRect(i, selectedColumn, true));
	// return;
	// }
	// }
	// }
}
 
开发者ID:javamelody,项目名称:javamelody,代码行数:47,代码来源:MBasicTable.java

示例7: mousePressed

public void mousePressed (
   final MouseEvent e
) {
   if (dialog.isFinalActionLaunched()) return;
   int x = e.getX(),xp;
   int y = e.getY(),yp;
   int currentPoint;
   boolean doubleClick = (System.currentTimeMillis() - mouseDownTime) <= 250L;
   mouseDownTime = System.currentTimeMillis();
   switch (tb.getCurrentTool()) {
      case ADD_CROSS:
         xp=mainImp.getWindow().getCanvas().offScreenX(x);
         yp=mainImp.getWindow().getCanvas().offScreenY(y);
         mainPh.addPoint(xp,yp);
         xp = positionX(mainImp, secondaryImp, mainImp.getWindow().getCanvas().offScreenX(x));
         yp = positionY(mainImp, secondaryImp, mainImp.getWindow().getCanvas().offScreenY(y));
         secondaryPh.addPoint(xp, yp);
         updateAndDraw();
         break;
      case MOVE_CROSS:
         currentPoint = mainPh.findClosest(x, y);
         secondaryPh.setCurrentPoint(currentPoint);
         updateAndDraw();
         break;
      case REMOVE_CROSS:
         currentPoint = mainPh.findClosest(x, y);
         mainPh.removePoint(currentPoint);
         secondaryPh.removePoint(currentPoint);
         updateAndDraw();
         break;
      case MASK:
      case INVERTMASK:
          if (mainPh.canAddMaskPoints()) {
             if (!doubleClick) {
                if (dialog.isClearMaskSet()) {
                   mainPh.clearMask();
                   dialog.setClearMask(false);
                   dialog.ungrayImage(this);
                }
                x = positionX(mainImp, secondaryImp, mainImp.getWindow().getCanvas().offScreenX(x));
                               y = positionY(mainImp, secondaryImp, mainImp.getWindow().getCanvas().offScreenY(y));
                mainPh.addMaskPoint(x,y);
             } else 
                mainPh.closeMask(tb.getCurrentTool());
             updateAndDraw();
         } else {
             IJ.error("A mask cannot be manually assigned since the mask was already in the stack");
         }
          break;
      case MAGNIFIER:
         final int flags = e.getModifiers();
         if ((flags & (Event.ALT_MASK | Event.META_MASK | Event.CTRL_MASK)) != 0) {
            mainImp.getWindow().getCanvas().zoomOut(x, y);
         }
         else {
            mainImp.getWindow().getCanvas().zoomIn(x, y);
         }
         break;
   }
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:60,代码来源:UnwarpJ_.java

示例8: mousePressed

/**
 * Method mouse pressed, allow all the different option over the images.
 *
 * @param e mouse event
 */
public void mousePressed (final MouseEvent e)
{
   if (dialog.isFinalActionLaunched()) 
	   return;
   int x = e.getX(),xp = 0;
   int y = e.getY(),yp = 0;
   int currentPoint = 0;
   boolean doubleClick = (System.currentTimeMillis() - mouseDownTime) <= 250L;
   this.mouseDownTime = System.currentTimeMillis();
   switch (tb.getCurrentTool()) 
   {
      case ADD_CROSS:
         xp = mainImp.getWindow().getCanvas().offScreenX(x);
         yp = mainImp.getWindow().getCanvas().offScreenY(y);
         mainPh.addPoint(xp, yp);

         xp = positionX(mainImp, secondaryImp, mainImp.getWindow().getCanvas().offScreenX(x));
         yp = positionY(mainImp, secondaryImp, mainImp.getWindow().getCanvas().offScreenY(y));
         secondaryPh.addPoint(xp, yp);

         updateAndDraw();
         break;
      case MOVE_CROSS:
         currentPoint = mainPh.findClosest(x, y);
         secondaryPh.setCurrentPoint(currentPoint);
         updateAndDraw();
         break;
      case REMOVE_CROSS:
         currentPoint = mainPh.findClosest(x, y);
         mainPh.removePoint(currentPoint);
         secondaryPh.removePoint(currentPoint);
         updateAndDraw();
         break;
      case MASK:
      case INVERTMASK:
          if (mainPh.canAddMaskPoints())
          {
             if (!doubleClick)
             {
                if (dialog.isClearMaskSet())
                {
                   mainPh.clearMask();
                   dialog.setClearMask(false);
                   dialog.ungrayImage(this);
                }
                x = positionX(mainImp, secondaryImp, mainImp.getWindow().getCanvas().offScreenX(x));
                y = positionY(mainImp, secondaryImp, mainImp.getWindow().getCanvas().offScreenY(y));

                mainPh.addMaskPoint(x, y);
             }
             else
                mainPh.closeMask(tb.getCurrentTool());
             updateAndDraw();
         } else {
             IJ.error("A mask cannot be manually assigned since the mask was already in the stack");
         }
          break;
      case MAGNIFIER:
         final int flags = e.getModifiers();
         if ((flags & (Event.ALT_MASK | Event.META_MASK | Event.CTRL_MASK)) != 0) {
            mainImp.getWindow().getCanvas().zoomOut(x, y);
         }
         else {
            mainImp.getWindow().getCanvas().zoomIn(x, y);
         }
         break;
   }
}
 
开发者ID:akmaier,项目名称:CONRAD,代码行数:73,代码来源:PointAction.java


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