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


Java InputEvent.CTRL_MASK属性代码示例

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


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

示例1: getModifiersString

/**
 * Get a string representation for key modifiers. Used to print trace.
 *
 * @param modifiers Bit mask of keyboard event modifiers.
 * @return a string representation for the keyboard event modifiers.
 */
public static String getModifiersString(int modifiers) {
    String result = "";
    if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        result = result + "CTRL_MASK | ";
    }
    if ((modifiers & InputEvent.META_MASK) != 0) {
        result = result + "META_MASK | ";
    }
    if ((modifiers & InputEvent.ALT_MASK) != 0) {
        result = result + "ALT_MASK | ";
    }
    if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        result = result + "ALT_GRAPH_MASK | ";
    }
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        result = result + "SHIFT_MASK | ";
    }
    if (result.length() > 0) {
        return result.substring(0, result.length() - 3);
    }
    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:28,代码来源:EventDispatcher.java

示例2: dispatchKeyEvent

@Override
public boolean dispatchKeyEvent(java.awt.event.KeyEvent e) {
    boolean isCtrl = e.getModifiers() == InputEvent.CTRL_MASK;
    boolean isCtrlShift = e.getModifiers() == (InputEvent.CTRL_MASK | InputEvent.SHIFT_MASK);
    boolean doPopup = (e.getKeyCode() == KeyEvent.VK_TAB) &&
            (isCtrl || isCtrlShift);
    if (doPopup && !KeyboardPopupSwitcher.isShown()) {
        // create popup with our SwitcherTable
        KeyboardPopupSwitcher.showPopup(new Model( items1, items2, true ), KeyEvent.VK_CONTROL, e.getKeyCode(), (e.getModifiers() & InputEvent.SHIFT_MASK)==0);
        return true;
    }
    if( KeyboardPopupSwitcher.isShown() ) {
        KeyboardPopupSwitcher.doProcessShortcut( e );
    }
    
    return false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:KeyboardPopupSwitcherTestHid.java

示例3: main

public static void main(final String[] args) {
    final int mask = InputEvent.META_DOWN_MASK | InputEvent.CTRL_MASK;

    Frame f = new Frame();

    MouseEvent mwe = new MouseWheelEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                         1, 1, 1);
    MouseEvent mdme = new MenuDragMouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1,
                                             true, null, null);
    MouseEvent me = new MouseEvent(f, 1, 1, mask, 1, 1, 1, 1, 1, true,
                                   MouseEvent.NOBUTTON);

    test(f, mwe);
    test(f, mdme);
    test(f, me);

    if (FAILED) {
        throw new RuntimeException("Wrong mouse event");
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:bug7170657.java

示例4: getModifierEx

public int getModifierEx() {
    int modifiersEx = 0;
    if (isShiftPressed()) {
        modifiersEx |= InputEvent.SHIFT_DOWN_MASK | InputEvent.SHIFT_MASK;
    }
    if (isCtrlPressed()) {
        modifiersEx |= InputEvent.CTRL_DOWN_MASK | InputEvent.CTRL_MASK;
    }
    if (isAltPressed()) {
        modifiersEx |= InputEvent.ALT_DOWN_MASK | InputEvent.ALT_MASK;
    }
    if (isMetaPressed()) {
        modifiersEx |= InputEvent.META_DOWN_MASK | InputEvent.META_MASK;
    }
    return modifiersEx;
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:16,代码来源:EventQueueDevice.java

示例5: mapNewModifiers

@SuppressWarnings("deprecation")
private static int mapNewModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_MASK;
    }
    if ((modifiers & InputEvent.ALT_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_DOWN_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_MASK;
    }
    if ((modifiers & InputEvent.CTRL_DOWN_MASK) != 0) {
        modifiers |= InputEvent.CTRL_MASK;
    }
    if ((modifiers & InputEvent.META_DOWN_MASK) != 0) {
        modifiers |= InputEvent.META_MASK;
    }

    return modifiers;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:AWTKeyStroke.java

示例6: mySetType

public void mySetType(String type) {
  SequenceEncoder.Decoder st = new SequenceEncoder.Decoder(type, ';');
  st.nextToken();
  name = st.nextToken("");
  action = st.nextToken(HIDE);
  propertyMatch.setExpression(st.nextToken(""));

  String keys = st.nextToken("");
  if (keys.indexOf(',') > 0) {
    watchKeys = NamedKeyStrokeArrayConfigurer.decode(keys);
  }
  else {
    watchKeys = new NamedKeyStroke[keys.length()];
    for (int i = 0; i < watchKeys.length; i++) {
      watchKeys[i] = new NamedKeyStroke(keys.charAt(i),InputEvent.CTRL_MASK);
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:18,代码来源:RestrictCommands.java

示例7: ModifierRobotKeyTest

public ModifierRobotKeyTest() throws Exception {
    modifierKeys =  new int[4];
    modifierKeys[0] = KeyEvent.VK_SHIFT;
    modifierKeys[1] = KeyEvent.VK_CONTROL;
    modifierKeys[2] = KeyEvent.VK_ALT;
    modifierKeys[3] = KeyEvent.VK_ALT_GRAPH;

    inputMasks = new int[4];
    inputMasks[0] =  InputEvent.SHIFT_MASK;
    inputMasks[1] =  InputEvent.CTRL_MASK;
    inputMasks[2] =  InputEvent.ALT_MASK;
    inputMasks[3] =  InputEvent.ALT_GRAPH_MASK;

    modifierStatus = new boolean[modifierKeys.length];

    textKeys = new int[2];
    textKeys[0] = KeyEvent.VK_A;

    String os = System.getProperty("os.name").toLowerCase();

    if (os.contains("solaris") || os.contains("sunos"))
        textKeys[1] = KeyEvent.VK_S;
    else if (os.contains("os x"))
        textKeys[1] = KeyEvent.VK_K;
    else
        textKeys[1] = KeyEvent.VK_I;

    textStatus = new boolean[textKeys.length];

    EventQueue.invokeAndWait( () -> { initializeGUI(); });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:31,代码来源:ModifierRobotKeyTest.java

示例8: mapOldModifiers

private static int mapOldModifiers(int modifiers) {
    if ((modifiers & InputEvent.SHIFT_MASK) != 0) {
        modifiers |= InputEvent.SHIFT_DOWN_MASK;
    }
    if ((modifiers & InputEvent.ALT_MASK) != 0) {
        modifiers |= InputEvent.ALT_DOWN_MASK;
    }
    if ((modifiers & InputEvent.ALT_GRAPH_MASK) != 0) {
        modifiers |= InputEvent.ALT_GRAPH_DOWN_MASK;
    }
    if ((modifiers & InputEvent.CTRL_MASK) != 0) {
        modifiers |= InputEvent.CTRL_DOWN_MASK;
    }
    if ((modifiers & InputEvent.META_MASK) != 0) {
        modifiers |= InputEvent.META_DOWN_MASK;
    }

    modifiers &= InputEvent.SHIFT_DOWN_MASK
        | InputEvent.ALT_DOWN_MASK
        | InputEvent.ALT_GRAPH_DOWN_MASK
        | InputEvent.CTRL_DOWN_MASK
        | InputEvent.META_DOWN_MASK
        | InputEvent.BUTTON1_DOWN_MASK
        | InputEvent.BUTTON2_DOWN_MASK
        | InputEvent.BUTTON3_DOWN_MASK;

    return modifiers;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:28,代码来源:AWTKeyStroke.java

示例9: doSingleClick

private void doSingleClick(MouseEvent evt, int line, int offset, int dot) {
	if ((evt.getModifiers() & InputEvent.SHIFT_MASK) != 0) {
		rectSelect = (evt.getModifiers() & InputEvent.CTRL_MASK) != 0;
		select(getMarkPosition(), dot);
	} else {
		setCaretPosition(dot);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:8,代码来源:JEditTextArea.java

示例10: getModifier

private int getModifier(int keycode) {
    switch (keycode) {
    case KeyEvent.VK_SHIFT:
        return InputEvent.SHIFT_MASK;
    case KeyEvent.VK_CONTROL:
        return InputEvent.CTRL_MASK;
    case KeyEvent.VK_ALT:
        return InputEvent.ALT_MASK;
    case KeyEvent.VK_META:
        return InputEvent.META_MASK;
    default:
        throw new RuntimeException(OSUtils.keyEventGetKeyText(keycode) + " is not a valid modifier");
    }
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:14,代码来源:KeyStrokeParser.java

示例11: serialize

@Test
public void serialize() throws Exception {
  Embellishment emb = new Embellishment();
  emb.activateCommand = "testActivateCommand";
  emb.activateModifiers = InputEvent.CTRL_MASK;
  emb.activateKey = "testActivateKey";
  emb.upCommand = "testUpCommand";
  emb.upModifiers = InputEvent.CTRL_MASK;
  emb.upKey = "testUpKey";
  emb.downCommand = "testDownCommand";
  emb.downModifiers = InputEvent.CTRL_MASK;
  emb.downKey = "testDownKey";
  emb.resetKey = new NamedKeyStroke("A");
  emb.resetLevel = new FormattedString("resetLevel");
  emb.drawUnderneathWhenSelected = true;
  emb.xOff = 1;
  emb.yOff = 2;
  emb.imageName = new String[] {"imageName1", "imageName2"};
  emb.commonName = new String[] {"commonName1", "commonName2"};
  emb.loopLevels = true;
  emb.name = "testName";
  emb.rndKey = new NamedKeyStroke("B");
  emb.followProperty = true;
  emb.propertyName = "testPropertyName";
  emb.firstLevelValue = 3;
  emb.version = 4;
  emb.alwaysActive = true;
  emb.activateKeyStroke = new NamedKeyStroke("C");
  emb.increaseKeyStroke = new NamedKeyStroke("D");
  emb.decreaseKeyStroke = new NamedKeyStroke("E");

  super.serializeTest(Embellishment.class, emb);
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:33,代码来源:EmbellishmentSerializeTest.java

示例12: actionPerformed

@Override
@SuppressWarnings("PMD.ConfusingTernary") // != 0 for binary mask is expected
public final void actionPerformed(final AnActionEvent event) {
    super.actionPerformed(event);

    if ((event.getModifiers() & (InputEvent.SHIFT_MASK | InputEvent.SHIFT_DOWN_MASK)) != 0) {
        getInsertArrayAction().actionPerformed(event);
    } else if ((event.getModifiers() & (InputEvent.CTRL_MASK | InputEvent.CTRL_DOWN_MASK)) != 0) {
        getSettingsAction().actionPerformed(event);
    } else {
        getInsertAction().actionPerformed(event);
    }
}
 
开发者ID:FWDekker,项目名称:intellij-randomness,代码行数:13,代码来源:DataGroupAction.java

示例13: createEvent

/**
 * 
 */
protected MouseEvent createEvent(DropTargetEvent e)
{
	JComponent component = getDropTarget(e);
	Point location = null;
	int action = 0;

	if (e instanceof DropTargetDropEvent)
	{
		location = ((DropTargetDropEvent) e).getLocation();
		action = ((DropTargetDropEvent) e).getDropAction();
	}
	else if (e instanceof DropTargetDragEvent)
	{
		location = ((DropTargetDragEvent) e).getLocation();
		action = ((DropTargetDragEvent) e).getDropAction();
	}

	if (location != null)
	{
		location = convertPoint(location);
		Rectangle r = graphComponent.getViewport().getViewRect();
		location.translate(r.x, r.y);
	}

	// LATER: Fetch state of modifier keys from event or via global
	// key listener using Toolkit.getDefaultToolkit().addAWTEventListener(
	// new AWTEventListener() {...}, AWTEvent.KEY_EVENT_MASK). Problem
	// is the event does not contain the modifier keys and the global
	// handler is not called during drag and drop.
	int mod = (action == TransferHandler.COPY) ? InputEvent.CTRL_MASK : 0;

	return new MouseEvent(component, 0, System.currentTimeMillis(), mod,
			location.x, location.y, 1, false, MouseEvent.BUTTON1);
}
 
开发者ID:GDSRS,项目名称:TrabalhoFinalEDA2,代码行数:37,代码来源:mxGraphHandler.java

示例14: performObjectAt

/** This method is called when user double-clicks on some object or
* presses Enter key.
* @param index Index of object in current explored context
*/
final void performObjectAt(int index, int modifiers) {
    if ((index < 0) || (index >= model.getSize())) {
        return;
    }

    VisualizerNode v = (VisualizerNode) model.getElementAt(index);
    Node node = v.node;

    // if DefaultProcessor is set, the default action is notified to it overriding the default action on nodes
    if (defaultProcessor != null) {
        defaultProcessor.actionPerformed(new ActionEvent(node, 0, null, modifiers));

        return;
    }

    if (showParentNode && NodeListModel.findVisualizerDepth(model, v) == -1) {
        try {
            manager.setExploredContextAndSelection(node.getParentNode(), new Node[] { node });
        } catch (PropertyVetoException ex) {
            // OK, let it be
        }
        return;
    }

    // on double click - invoke default action, if there is any
    // (unless user holds CTRL key what means that we should always dive into the context)
    Action a = node.getPreferredAction();

    if ((a != null) && ((modifiers & InputEvent.CTRL_MASK) == 0)) {
        a = TreeView.takeAction(a, node);

        if (a.isEnabled()) {
            a.actionPerformed(new ActionEvent(node, ActionEvent.ACTION_PERFORMED, "")); // NOI18N
        } else {
            Utilities.disabledActionBeep();
        }
    }
    // otherwise dive into the context
    else if (traversalAllowed && (!node.isLeaf())) {
        manager.setExploredContext(node, manager.getSelectedNodes());
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:46,代码来源:ListView.java

示例15: getFocusAcceleratorKeyMask

/**
 * Returns key modifiers used by Swing to set up a focus accelerator key
 * stroke.
 */
@Override
public int getFocusAcceleratorKeyMask() {
    return InputEvent.CTRL_MASK | InputEvent.ALT_MASK;
}
 
开发者ID:lambdalab-mirror,项目名称:jdk8u-jdk,代码行数:8,代码来源:LWCToolkit.java


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