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


Java KeyEvent.VK_UP属性代码示例

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


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

示例1: keyTyped

@Override
public void keyTyped(KeyEvent ke) {             
   if(ke.getSource() == frame.getjList1()) {
        if(ke.getKeyCode() == KeyEvent.VK_UP ||
            ke.getKeyCode() == KeyEvent.VK_DOWN ||
            ke.getKeyCode() == KeyEvent.VK_ENTER ||
            ke.getKeyCode() == KeyEvent.VK_CONTROL) {                
            return;
        } else {
            int selection = frame.getjList1().getSelectedIndex();
            for(int i = 0; i < pane.getKeyListeners().length; ++i) {
            if(pane.getKeyListeners()[i] != this) 
                    pane.getKeyListeners()[i].keyTyped(ke);
            }
            giveMenuOptions();
            ke.consume();
            frame.getjList1().setSelectedIndex(selection);
        }            
        
   }
}
 
开发者ID:Skypr,项目名称:BEAST,代码行数:21,代码来源:AutocompletionController.java

示例2: bufferBiasTextFieldKeyPressed

private void bufferBiasTextFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_bufferBiasTextFieldKeyPressed
        // key pressed in text field
        //        System.out.println("keyPressed evt "+evt);
        //        System.out.println("value field key pressed");
        int code = evt.getKeyCode();
        boolean shifted = evt.isShiftDown();
        float byRatio = 1.02f;
        if (code == KeyEvent.VK_UP) {
            startEdit();
            if (shifted) {
                pot.setBufferBitValue(pot.getBufferBitValue() + 1);
            } else {
                pot.changeBufferBiasByRatio(byRatio);
            }
            endEdit();
        } else if (code == KeyEvent.VK_DOWN) {
            startEdit();
            if (shifted) {
                pot.setBufferBitValue(pot.getBufferBitValue() - 1);
            } else {
                pot.changeBufferBiasByRatio(1f / byRatio);
            }
            endEdit();
        }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:25,代码来源:ConfigurableIPotGUIControl.java

示例3: checkInput

public void checkInput() {
		KeyEvent event = buffer.pop();
		if (event != null){
			if (event.getID() == java.awt.event.KeyEvent.KEY_PRESSED){
				switch(event.getKeyCode()) {
				case KeyEvent.VK_UP:
					snake.setDirection('U');
					break;
				case KeyEvent.VK_DOWN:
					snake.setDirection('D');
					break;
				case KeyEvent.VK_LEFT:
					snake.setDirection('L');
					break;
				case KeyEvent.VK_RIGHT:
					snake.setDirection('R');
					break;
				}
				
			}
			//System.out.println(event.getKeyCode());
		}
		buffer.clear();
}
 
开发者ID:JonathanTheZero,项目名称:LEDBoard-Game-Collection,代码行数:24,代码来源:ScreenOne.java

示例4: commandKeyPressed

private void commandKeyPressed(java.awt.event.KeyEvent evt) {
    if (evt.getKeyCode()==KeyEvent.VK_DOWN) {
        if(displayer.isVisible()) {
            displayer.selectNext();
            evt.consume();
        }
    } else if (evt.getKeyCode() == KeyEvent.VK_UP) {
        if(displayer.isVisible()) {
            displayer.selectPrev();
            evt.consume();
        }
    } else if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
        if(displayer.isVisible()) {
            evt.consume();
            invokeSelectedItem();
        }
    } else if ((evt.getKeyCode()) == KeyEvent.VK_ESCAPE) {
            if(displayer.isVisible()) {
                returnFocus();
                displayer.clearModel();
                requestFocus();
                evt.consume();
            }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:QuickSearchComboBar.java

示例5: listKeyPressed

private void listKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_listKeyPressed
    // UP / DOWN just wraps around the list
    // TODO: convert to action & bind to action map
    int index = list.getSelectedIndex();
    if (evt.getKeyCode() == KeyEvent.VK_UP) {
        list.setSelectedIndex(index == 0 ? model.getSize() - 1 : index - 1);
    } 
    if (evt.getKeyCode() == KeyEvent.VK_DOWN) {
        list.setSelectedIndex(index == (model.getSize() - 1) ? 0 : index + 1);
    }
    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
        if (!list.isSelectionEmpty()) {
            itemSelected(list.getSelectedIndex());
        }
    }
    evt.consume();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:ShortcutPopupPanel.java

示例6: keyPressed

public void keyPressed(KeyEvent e) {
	int i = targetList.getSelectedIndex();
	switch (e.getKeyCode()) {
	case KeyEvent.VK_UP:
		i = targetList.getSelectedIndex() - 1;
		if (i < 0) {
			i = 0;
		}
		targetList.setSelectedIndex(i);
		break;
	case KeyEvent.VK_DOWN:
		int listSize = targetList.getModel().getSize();
		i = targetList.getSelectedIndex() + 1;
		if (i >= listSize) {
			i = listSize - 1;
		}
		targetList.setSelectedIndex(i);
		break;
	default:
		break;
	}
}
 
开发者ID:KevinPriv,项目名称:Luyten4Forge,代码行数:22,代码来源:JFontChooser.java

示例7: performAction

public static void performAction(Node[] nodes, int keyCode) {
    int dimension = (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_RIGHT)
            ? LayoutConstants.HORIZONTAL : LayoutConstants.VERTICAL;
    int direction = (keyCode == KeyEvent.VK_LEFT || keyCode == KeyEvent.VK_UP)
            ? LayoutConstants.LEADING : LayoutConstants.TRAILING;
    duplicate(nodes, dimension, direction);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:7,代码来源:DuplicateAction.java

示例8: coarseBiasTextFieldKeyPressed

private void coarseBiasTextFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_coarseBiasTextFieldKeyPressed
        int code = evt.getKeyCode();
        if (code == KeyEvent.VK_UP) {
            startEdit();
            dontProcessCoarseBiasSlider=true;
            pot.setCoarseBitValue(pot.getCoarseBitValue() - 1);
            endEdit();
        } else if (code == KeyEvent.VK_DOWN) {
            dontProcessCoarseBiasSlider=true;
            startEdit();
            pot.setCoarseBitValue(pot.getCoarseBitValue() + 1);
            endEdit();
        }
//        log.info(pot.toString());
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:15,代码来源:AddressedIPotCFGUIControl.java

示例9: keyReleased

public void keyReleased(java.awt.event.KeyEvent evt) {
    if(!isInteger()) return;
    int key = evt.getKeyCode();
    int step = 0;
    if(key == KeyEvent.VK_UP || key == KeyEvent.VK_RIGHT) step = 1;
    else if(key == KeyEvent.VK_DOWN || key == KeyEvent.VK_LEFT) step = -1;
    if(step == 0) return;
    int i = Integer.parseInt(textField.getText()) + step;
    textField.setText(Integer.toString(i));
    updateValue();
}
 
开发者ID:etomica,项目名称:etomica,代码行数:11,代码来源:DeviceBox.java

示例10: keyReleased

@Override
public void keyReleased(KeyEvent arg0) {
	// TODO Auto-generated method stub
	int keyCode = arg0.getKeyCode();
	if(keyCode == KeyEvent.VK_RIGHT){
		player.setRight(false);
	}
	if(keyCode == KeyEvent.VK_LEFT){
		player.setLeft(false);
	}
	if(keyCode == KeyEvent.VK_UP){
		player.setUp(false);
	}
	if(keyCode == KeyEvent.VK_DOWN){
		player.setDown(false);
	}
	if(keyCode == KeyEvent.VK_SPACE){
		player.setAttacking(false);
	}
	if(keyCode == KeyEvent.VK_ESCAPE) {
		setVisible(false);
		f.getContentPane().removeAll();
		f.setVisible(false);
		new Menu();
	}
	
}
 
开发者ID:berkunal,项目名称:SWEngProject,代码行数:27,代码来源:Game.java

示例11: keySet

public static void keySet(int i, boolean b) {
	if(i == KeyEvent.VK_UP) keyState[UP] = b;
	else if(i == KeyEvent.VK_LEFT) keyState[LEFT] = b;
	else if(i == KeyEvent.VK_DOWN) keyState[DOWN] = b;
	else if(i == KeyEvent.VK_RIGHT) keyState[RIGHT] = b;
	else if(i == KeyEvent.VK_W) keyState[BUTTON1] = b;
	else if(i == KeyEvent.VK_E) keyState[BUTTON2] = b;
	else if(i == KeyEvent.VK_R) keyState[BUTTON3] = b;
	else if(i == KeyEvent.VK_F) keyState[BUTTON4] = b;
	else if(i == KeyEvent.VK_ENTER) keyState[ENTER] = b;
	else if(i == KeyEvent.VK_ESCAPE) keyState[ESCAPE] = b;
}
 
开发者ID:tonikolaba,项目名称:BatBat-Game,代码行数:12,代码来源:Keys.java

示例12: fineBiasTextFieldKeyPressed

private void fineBiasTextFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_fineBiasTextFieldKeyPressed
        // key pressed in text field
        //        System.out.println("keyPressed evt "+evt);
        //        System.out.println("value field key pressed");
        int code = evt.getKeyCode();
        if (code == KeyEvent.VK_UP) {
            startEdit();
            pot.setFineBitValue(pot.getFineBitValue() + 1);
            endEdit();
        } else if (code == KeyEvent.VK_DOWN) {
            startEdit();
            pot.setFineBitValue(pot.getFineBitValue() - 1);
            endEdit();
        }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:15,代码来源:AddressedIPotCFGUIControl.java

示例13: keyPressed

public void keyPressed(KeyEvent event) {
    int code = event.getKeyCode();
    switch (code) {
        case KeyEvent.VK_TAB:
            completeAction(event);
            break;
        case KeyEvent.VK_LEFT:
        case KeyEvent.VK_BACK_SPACE:
            backAction(event);
            break;
        case KeyEvent.VK_UP:
            upAction(event);
            break;
        case KeyEvent.VK_DOWN:
            downAction(event);
            break;
        case KeyEvent.VK_ENTER:
            enterAction(event);
            break;
        case KeyEvent.VK_HOME:
            event.consume();
            area.setCaretPosition(startPos);
            break;
        case KeyEvent.VK_D:
            if ((event.getModifiersEx() & KeyEvent.CTRL_DOWN_MASK) != 0) {
                event.consume();
                inputJoin.send(Channel.LINE, EMPTY_LINE);
            }
            break;
    }

    if (completePopup.isVisible() && code != KeyEvent.VK_TAB
            && code != KeyEvent.VK_UP && code != KeyEvent.VK_DOWN)
        completePopup.setVisible(false);
}
 
开发者ID:Vitaliy-Yakovchuk,项目名称:ramus,代码行数:35,代码来源:TextAreaReadline.java

示例14: keyPressed

@Override
public void keyPressed(KeyEvent e) {
    if (LOG.isLoggable(Level.FINE)) {
        LOG.fine("BookmarkHistoryPopup.keyPressed: e=" + e + '\n');
    }
    int keyCode = e.getKeyCode();
    if (gotoPreviousKeyStroke != null && gotoPreviousKeyStroke.getKeyCode() == keyCode) {
        e.consume();
        selectPrevious();
    } else if (gotoNextKeyStroke != null && gotoNextKeyStroke.getKeyCode() == keyCode) {
        e.consume();
        selectNext();
    } else {
        switch (keyCode) {
            case KeyEvent.VK_ENTER:
                BookmarkInfo selectedBookmark = getSelectedBookmark();
                hide();
                openBookmark(selectedBookmark);
                e.consume();
                break;

            case KeyEvent.VK_ESCAPE:
                e.consume();
                hide();
                returnFocus();
                break;

            case KeyEvent.VK_DOWN:
                e.consume();
                selectNext();
                break;

            case KeyEvent.VK_UP:
                e.consume();
                selectPrevious();
                break;
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:39,代码来源:BookmarkHistoryPopup.java

示例15: getButton

private static int getButton(int direction, int orientation) {
    if (direction == ScrollAdjuster.DECREASE_SCROLL_DIRECTION) {
        return (orientation == Adjustable.HORIZONTAL) ? KeyEvent.VK_LEFT : KeyEvent.VK_DOWN;
    } else {
        return (orientation == Adjustable.HORIZONTAL) ? KeyEvent.VK_RIGHT : KeyEvent.VK_UP;
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:7,代码来源:KeyboardJSliderScrollDriver.java


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