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


Java KeyEvent.VK_DOWN属性代码示例

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


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

示例1: getKeys

@Override
public NavigationKey[] getKeys(ComponentOperator oper) {
    boolean multiString = oper instanceof TextAreaOperator;
    NavigationKey[] result = new NavigationKey[multiString ? 4 : 2];
    result[0] = new UpKey(KeyEvent.VK_LEFT, 0);
    result[1] = new DownKey(KeyEvent.VK_RIGHT, 0);
    ((UpKey) result[0]).setDownKey((DownKey) result[1]);
    ((DownKey) result[1]).setUpKey((UpKey) result[0]);
    if (multiString) {
        result[2] = new UpKey(KeyEvent.VK_UP, 0);
        result[3] = new DownKey(KeyEvent.VK_DOWN, 0);
        ((UpKey) result[2]).setDownKey((DownKey) result[3]);
        ((DownKey) result[3]).setUpKey((UpKey) result[2]);
    }
    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:16,代码来源:AWTTextKeyboardDriver.java

示例2: keyPressed

@Override
public void keyPressed(KeyEvent e) {
    int step = e.isControlDown() ? 50 : e.isAltDown() ? 1 : 5;
    switch (e.getKeyCode()) {
        case KeyEvent.VK_LEFT:
            setLocation(getX() - step, getY());
            break;
        case KeyEvent.VK_RIGHT:
            setLocation(getX() + step, getY());
            break;
        case KeyEvent.VK_UP:
            setLocation(getX(), getY() - step);
            break;
        case KeyEvent.VK_DOWN:
            setLocation(getX(), getY() + step);
            break;
        case KeyEvent.VK_ESCAPE:
            exitAction.actionPerformed(null);
    }
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:20,代码来源:Ruler.java

示例3: 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

示例4: execute

/**
 * execute
 * called by an element and use the code of the last key pressed to use the specific method to move the element
 * */
@Override
public void execute() {
    switch (this.lastKey){
        case KeyEvent.VK_UP:
            this.element.goUp();
            break;
        case KeyEvent.VK_DOWN:
            this.element.goDown();
            break;
        case KeyEvent.VK_LEFT:
            this.element.goLeft();
            break;
        case KeyEvent.VK_RIGHT:
            this.element.goRight();
            break;
        default:
            this.element.goRest();
    }
}
 
开发者ID:Exia-Aix-A2,项目名称:Boulder-Dash,代码行数:23,代码来源:ArrowKeyControl.java

示例5: selectItem

@Override
public void selectItem(ComponentOperator oper, int index) {
    ListOperator loper = (ListOperator) oper;
    if (loper.isMultipleMode()) {
        super.selectItem(loper, index);
    }
    DriverManager.getFocusDriver(oper).giveFocus(oper);
    KeyDriver kDriver = DriverManager.getKeyDriver(oper);
    int current = loper.getSelectedIndex();
    int diff = 0;
    int key = 0;
    if (index > current) {
        diff = index - current;
        key = KeyEvent.VK_DOWN;
    } else {
        diff = current - index;
        key = KeyEvent.VK_UP;
    }
    Timeout pushTime = oper.getTimeouts().create("ComponentOperator.PushKeyTimeout");
    for (int i = 0; i < diff; i++) {
        kDriver.pushKey(oper, key, 0, pushTime);
    }
    kDriver.pushKey(oper, KeyEvent.VK_ENTER, 0, pushTime);
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:24,代码来源:ListKeyboardDriver.java

示例6: getButton

private Button getButton(KeyEvent e) {
    switch (e.getKeyCode()) {
        case KeyEvent.VK_LEFT:
            return Button.LEFT;

        case KeyEvent.VK_RIGHT:
            return Button.RIGHT;

        case KeyEvent.VK_UP:
            return Button.UP;

        case KeyEvent.VK_DOWN:
            return Button.DOWN;

        case KeyEvent.VK_Z:
            return Button.A;

        case KeyEvent.VK_X:
            return Button.B;

        case KeyEvent.VK_ENTER:
            return Button.START;

        case KeyEvent.VK_BACK_SPACE:
            return Button.SELECT;
    }
    return null;
}
 
开发者ID:trekawek,项目名称:coffee-gb,代码行数:28,代码来源:SwingController.java

示例7: onInputFieldKeyPressedEvent

protected void onInputFieldKeyPressedEvent(KeyEvent e)
{
	if (this.inputHistory.isEmpty()) return;

	if (e.getKeyCode() == KeyEvent.VK_UP)
	{
		this.inputHistoryIndex++;

		if (this.inputHistoryIndex >= this.inputHistory.size())
		{
			this.inputHistoryIndex = this.inputHistory.size() - 1;
		}

		this.inputField.setText(this.inputHistory.get(this.inputHistoryIndex));
	}
	else if (e.getKeyCode() == KeyEvent.VK_DOWN)
	{
		this.inputHistoryIndex--;

		if (this.inputHistoryIndex < 0)
		{
			this.inputField.setText("");
			this.inputHistoryIndex = -1;
		}
		else
		{
			this.inputField.setText(this.inputHistory.get(this.inputHistoryIndex));
		}
	}
}
 
开发者ID:andykuo1,项目名称:candlelight,代码行数:30,代码来源:Console.java

示例8: regBiasTextFieldKeyPressed

private void regBiasTextFieldKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_regBiasTextFieldKeyPressed
        // 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) {
            pot.setRegBitValue(pot.getRegBitValue() + 1);
            endEdit();
        } else if (code == KeyEvent.VK_DOWN) {
            startEdit();
            pot.setRegBitValue(pot.getRegBitValue() - 1);
            endEdit();
        }
        pot.updateBitValue();
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:15,代码来源:ShiftedSourceControlsCF.java

示例9: keyPressed

public void keyPressed(KeyEvent e) {

      /*
       * Pass key onto window scroller if no region selected
       * or control key not used.
       */
      if (selectedRegions.isEmpty() || !e.isControlDown())
        return;

      int dx = 0, dy = 0, delta = 1;

      if (e.isShiftDown()) {
        delta = 5;
      }

      switch (e.getKeyCode()) {
        case KeyEvent.VK_UP:
          dy = -delta;
          break;
        case KeyEvent.VK_DOWN:
          dy = delta;
          break;
        case KeyEvent.VK_LEFT:
          dx = -delta;
          break;
        case KeyEvent.VK_RIGHT:
          dx = delta;
          break;
        default :
          return;
      }

      for (Region r : selectedRegions) {
        r.move(dx, dy, view);
      }

      view.repaint();
      e.consume();
    }
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:39,代码来源:RegionGrid.java

示例10: 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

示例11: bufferCurrentTFKeyPressed

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

示例12: keyPressed

@Override
public void keyPressed(KeyEvent e) {
	// TODO Auto-generated method stub
	if(e.getKeyCode() == KeyEvent.VK_DELETE || e.getKeyCode() == KeyEvent.VK_BACK_SPACE ) {
		if(isEditable()){
			if((PrincipalWindow.interpreter.getText().substring(PrincipalWindow.interpreter.getText().length()-2).equals("/>")))
			e.consume();}
		else
			e.consume();
	}
	
	if(e.getKeyCode() == KeyEvent.VK_ENTER && !isEditable() ) 
		e.consume();
	
	if(e.getKeyCode() == KeyEvent.VK_UP && isEditable() ){
		e.consume();
		if(!(Math.abs(Interpreter.historyCounter)>=Interpreter.historyQuery.size()))
			Interpreter.historyCounter --;
		else
			Interpreter.historyCounter = -Interpreter.historyQuery.size();

		displayHistory();
	}
	if(e.getKeyCode() == KeyEvent.VK_DOWN && isEditable() ){
		e.consume();
		if(Interpreter.historyCounter < 0)
			Interpreter.historyCounter ++;
		else
			Interpreter.historyCounter = 0;
		
		displayHistory();
	}	
}
 
开发者ID:BlidiWajdi,项目名称:Mujeed-Arabic-Prolog,代码行数:33,代码来源:KeyMonitor.java

示例13: keyPressed

@Override
public void keyPressed(KeyEvent e) {
    if (diagramaAtual != null) {
        switch (e.getKeyCode()) {
            case KeyEvent.VK_LEFT:
            case KeyEvent.VK_RIGHT:
            case KeyEvent.VK_UP:
            case KeyEvent.VK_DOWN:
            case KeyEvent.VK_ESCAPE:
            case KeyEvent.VK_ENTER:
                diagramaAtual.ProcesseTeclas(e);
                break;
            case KeyEvent.VK_DELETE:
                if (diagramaAtual != null) {
                    diagramaAtual.deleteSelecao();
                    e.consume();
                }
                break;
            case KeyEvent.VK_TAB:
                if (e.isControlDown()) {
                    if (e.isShiftDown()) {
                        if (diagramaAtual.SelecioneAnterior()) {
                            e.consume();
                        }
                    } else if (diagramaAtual.SelecioneProximo()) {
                        e.consume();
                    }
                } else {
                    transferFocus();
                }
                break;
        }
    }
}
 
开发者ID:chcandido,项目名称:brModelo,代码行数:34,代码来源:Editor.java

示例14: keyPressed

@Override
public void keyPressed(final KeyEvent e) {
	final boolean up = (e.getKeyCode() == KeyEvent.VK_UP);
	final boolean down = (e.getKeyCode() == KeyEvent.VK_DOWN);

	if (up || down) {
		incValueAndUpdateGUI(up ? 1 : -1, (JTextField) e.getSource());
	}
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:9,代码来源:AbstractMultiBitRegisterCP.java

示例15: showWindow

private void showWindow() {
    List<DVThread> threads = ThreadsHistoryAction.getThreads();
    int threadsCount = threads.size();
    if (threadsCount < 1) {
        Toolkit.getDefaultToolkit().beep();
        return;
    }
    int triggerKey = KeyEvent.VK_DOWN;
    int releaseKey = KeyEvent.VK_ENTER;
    KeyboardPopupSwitcher.selectItem(
            ThreadsHistoryAction.createSwitcherItems(threads),
            releaseKey, triggerKey, true, true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:13,代码来源:SetCurrentThreadFromHistoryAction.java


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