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


Java KeyEvent.VK_INSERT属性代码示例

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


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

示例1: toggle

/**
	  * This method is used to turn keyboard key presses into actions
	  */
	 private void toggle(KeyEvent ke, boolean pressed) {
		  if ( ke.getKeyCode( ) == KeyEvent.VK_NUMPAD8 ) up.toggle( pressed ); //press keypad 8, moves up
		  if ( ke.getKeyCode( ) == KeyEvent.VK_NUMPAD2 ) down.toggle( pressed ); //press keypad 2, moves down
		  if ( ke.getKeyCode( ) == KeyEvent.VK_NUMPAD4 ) left.toggle( pressed ); //press keypad 4, moves left
		  if ( ke.getKeyCode( ) == KeyEvent.VK_NUMPAD6 ) right.toggle( pressed ); //press keypad 6, moves right
		  if ( ke.getKeyCode( ) == KeyEvent.VK_W ) up.toggle( pressed ); //press W, moves up
		  if ( ke.getKeyCode( ) == KeyEvent.VK_S ) down.toggle( pressed ); //press S, moves down
		  if ( ke.getKeyCode( ) == KeyEvent.VK_A ) left.toggle( pressed ); //press A, moves left
		  if ( ke.getKeyCode( ) == KeyEvent.VK_D ) right.toggle( pressed ); //press D, moves right
		  if ( ke.getKeyCode( ) == KeyEvent.VK_UP ) up.toggle( pressed ); //press up arrow, moves up
		  if ( ke.getKeyCode( ) == KeyEvent.VK_DOWN ) down.toggle( pressed ); //press down arrow, moves down
		  if ( ke.getKeyCode( ) == KeyEvent.VK_LEFT ) left.toggle( pressed ); //press left arrow, moves left
		  if ( ke.getKeyCode( ) == KeyEvent.VK_RIGHT ) right.toggle( pressed ); //press right arrow, moves right

//		  if ( ke.getKeyCode( ) == KeyEvent.VK_TAB ) menu.toggle( pressed ); //press Tab, menu toggled
//		  if ( ke.getKeyCode( ) == KeyEvent.VK_ALT ) menu.toggle( pressed ); //press Alt, menu toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_ALT_GRAPH ) menu.toggle( pressed ); //press Alt-Graph, menu toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_SPACE ) attack.toggle( pressed ); //press space, attack toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_CONTROL ) attack.toggle( pressed ); //press Ctrl, attack toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_NUMPAD0 ) attack.toggle( pressed ); //press keypad 0, attack toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_INSERT ) attack.toggle( pressed ); //press Insert, attack toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_ENTER ) menu.toggle( pressed ); //press Enter, attack toggled
		  
		  if ( ke.getKeyCode( ) == KeyEvent.VK_X ) menu.toggle( pressed ); //press X, menu toggled
		  if ( ke.getKeyCode( ) == KeyEvent.VK_C ) attack.toggle( pressed ); // press C, attack toggled
	 }
 
开发者ID:BrianGaucher,项目名称:Camasia,代码行数:29,代码来源:InputHandler.java

示例2: keyPressed

/**
 * {@inheritDoc}
 */
@Override
public void keyPressed(KeyEvent e) {

    switch (e.getKeyCode()) {
        //
        // 6 key editing group
        //
        case KeyEvent.VK_INSERT:
            sendChars(e, "\033[L");         // NOI18N
            break;
        case KeyEvent.VK_HOME:
            sendChars(e, "\033[H");         // NOI18N
            break;

        //
        // Arrow keys
        //
        case KeyEvent.VK_UP:
            sendChars(e, "\033[A");         // NOI18N
            break;
        case KeyEvent.VK_DOWN:
            sendChars(e, "\033[B");         // NOI18N
            break;
        case KeyEvent.VK_RIGHT:
            sendChars(e, "\033[C");         // NOI18N
            break;
        case KeyEvent.VK_LEFT:
            sendChars(e, "\033[D");         // NOI18N
            break;

    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:35,代码来源:InterpANSI.java

示例3: onKeyPressed

final void onKeyPressed(final int keyCode) {
	if (keyCode == KeyEvent.VK_DELETE) {
		controller.actionRemove();
	} else if (keyCode == KeyEvent.VK_INSERT) {
		controller.actionAddDirectory();
	}
}
 
开发者ID:evernat,项目名称:dead-code-detector,代码行数:7,代码来源:ParametersPanel.java

示例4: keyPressed

@Override
public void keyPressed(KeyEvent e) {
	int ign = InputEvent.ALT_DOWN_MASK | InputEvent.CTRL_DOWN_MASK | InputEvent.META_DOWN_MASK;
	if ((e.getModifiersEx() & ign) != 0)
		return;
	switch (e.getKeyCode()) {
	case KeyEvent.VK_LEFT:
	case KeyEvent.VK_KP_LEFT:
		if (pos > 0)
			--pos;
		break;
	case KeyEvent.VK_RIGHT:
	case KeyEvent.VK_KP_RIGHT:
		if (pos < curText.length())
			++pos;
		break;
	case KeyEvent.VK_HOME:
		pos = 0;
		break;
	case KeyEvent.VK_END:
		pos = curText.length();
		break;
	case KeyEvent.VK_ESCAPE:
	case KeyEvent.VK_CANCEL:
		cancelEditing();
		break;
	case KeyEvent.VK_CLEAR:
		curText = "";
		pos = 0;
		break;
	case KeyEvent.VK_ENTER:
		stopEditing();
		break;
	case KeyEvent.VK_BACK_SPACE:
		if (pos > 0) {
			curText = curText.substring(0, pos - 1) + curText.substring(pos);
			--pos;
			field.setText(curText);
		}
		break;
	case KeyEvent.VK_DELETE:
		if (pos < curText.length()) {
			curText = curText.substring(0, pos) + curText.substring(pos + 1);
			field.setText(curText);
		}
		break;
	case KeyEvent.VK_INSERT:
	case KeyEvent.VK_COPY:
	case KeyEvent.VK_CUT:
	case KeyEvent.VK_PASTE:
		// TODO: enhance label editing
		break;
	default:
		; // ignore
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:56,代码来源:TextFieldCaret.java


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