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


Java KeyEvent.VK_HOME属性代码示例

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


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

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

示例2: handleSpecialKey

public void handleSpecialKey(KeyEvent ke) {
    if(ke.getKeyCode() == KeyEvent.VK_END) {
        insertToCode.moveToEndOfCurrentLine();
    } else if(ke.getKeyCode() == KeyEvent.VK_HOME) {
        insertToCode.moveToStartOfCurrentLine();
    }  
}
 
开发者ID:Skypr,项目名称:BEAST,代码行数:7,代码来源:CodeInputHandler.java

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

示例4: getKeyEvent

public int getKeyEvent(String key) {
    switch (key.toUpperCase()) {
        case "TAB":
            return KeyEvent.VK_TAB;
        case "ENTER":
            return KeyEvent.VK_ENTER;
        case "SHIFT":
            return KeyEvent.VK_SHIFT;
        case "CTRL":
            return KeyEvent.VK_CONTROL;
        case "ALT":
            return KeyEvent.VK_ALT;
        case "START":
            return KeyEvent.VK_WINDOWS;
        case "DELETE":
            return KeyEvent.VK_DELETE;
        case "BACKSPACE":
            return KeyEvent.VK_BACK_SPACE;
        case "HOME":
            return KeyEvent.VK_HOME;
        case "PAGE_UP":
        case "PAGEUP":
            return KeyEvent.VK_PAGE_UP;
        case "PAGE_DOWN":
        case "PAGEDOWN":
            return KeyEvent.VK_PAGE_DOWN;
        case "UP":
            return KeyEvent.VK_UP;
        case "DOWN":
            return KeyEvent.VK_DOWN;
        case "LEFT":
            return KeyEvent.VK_LEFT;
        case "RIGHT":
            return KeyEvent.VK_RIGHT;
        default:
            return KeyEvent.VK_ESCAPE;
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:38,代码来源:ImageCommand.java

示例5: ModifierRobotEnhancedKeyTest

public ModifierRobotEnhancedKeyTest() 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[6];
    textKeys[0] = KeyEvent.VK_A;
    textKeys[1] = KeyEvent.VK_S;
    textKeys[2] = KeyEvent.VK_DELETE;
    textKeys[3] = KeyEvent.VK_HOME;
    textKeys[4] = KeyEvent.VK_F12;
    textKeys[5] = KeyEvent.VK_LEFT;

    textStatus = new boolean[textKeys.length];

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

示例6: getKeys

@Override
public NavigationKey[] getKeys(ComponentOperator oper) {
    boolean multiString
            = oper instanceof JTextAreaOperator
            || oper instanceof JEditorPaneOperator;
    NavigationKey[] result = new NavigationKey[multiString ? 8 : 4];
    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]);
        result[4] = new UpKey(KeyEvent.VK_PAGE_UP, 0);
        result[5] = new DownKey(KeyEvent.VK_PAGE_DOWN, 0);
        ((UpKey) result[4]).setDownKey((DownKey) result[5]);
        ((DownKey) result[5]).setUpKey((UpKey) result[4]);
        result[6] = new HomeKey(KeyEvent.VK_HOME, InputEvent.CTRL_MASK);
        result[7] = new EndKey(KeyEvent.VK_END, InputEvent.CTRL_MASK, this, oper);
    } else {
        result[2] = new HomeKey(KeyEvent.VK_HOME, 0);
        result[3] = new EndKey(KeyEvent.VK_END, 0, this, oper);
    }
    return result;
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:SwingTextKeyboardDriver.java

示例7: keyPressed

@Override
public void keyPressed(InstanceState state, KeyEvent e) {
	KeyboardData data = getKeyboardState(state);
	boolean changed = false;
	boolean used = true;
	synchronized (data) {
		switch (e.getKeyCode()) {
		case KeyEvent.VK_DELETE:
			changed = data.delete();
			break;
		case KeyEvent.VK_LEFT:
			data.moveCursorBy(-1);
			break;
		case KeyEvent.VK_RIGHT:
			data.moveCursorBy(1);
			break;
		case KeyEvent.VK_HOME:
			data.setCursor(0);
			break;
		case KeyEvent.VK_END:
			data.setCursor(Integer.MAX_VALUE);
			break;
		default:
			used = false;
		}
	}
	if (used)
		e.consume();
	if (changed)
		state.getInstance().fireInvalidated();
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:31,代码来源:Keyboard.java

示例8: keyPressed

public void keyPressed(KeyEvent e) {
    switch (e.getKeyCode()) {
    case KeyEvent.VK_UP:
        arrowKeySelect(DIRECTION_UP);
        break;
    case KeyEvent.VK_DOWN:
        arrowKeySelect(DIRECTION_DOWN);
        break;
    case KeyEvent.VK_ENTER:
        doubleClickEventDispatch();
        break;
    case KeyEvent.VK_PAGE_DOWN:
        pageScrollViewport(DIRECTION_DOWN);
        break;
    case KeyEvent.VK_PAGE_UP:
        pageScrollViewport(DIRECTION_UP);
        break;
    case KeyEvent.VK_HOME:
        ((ScrollPane)callback.getPane()).setScrollPosition(((ScrollPane)callback.getPane()).getScrollPosition().x, 0);
        break;
    case KeyEvent.VK_END:
        ((ScrollPane)callback.getPane()).setScrollPosition(((ScrollPane)callback.getPane()).getScrollPosition().x,
                callback.getSize().height);
        break;
    default:
        ;
    }

    callback.repaint();
}
 
开发者ID:addertheblack,项目名称:myster,代码行数:30,代码来源:MCListEventHandler.java

示例9: keyPressed

@Override
public void keyPressed(KeyEvent e) {
    int code = e.getKeyCode();
    boolean consumeEvent = true;
    switch (code) {
        case KeyEvent.VK_ENTER:
        case KeyEvent.VK_SPACE:
            // selection confirmed
            releaseUI(true);
            break;
        case KeyEvent.VK_ESCAPE:
            // action canceled
            releaseUI(false);
            break;
        case KeyEvent.VK_RIGHT:
        case KeyEvent.VK_DOWN:
        case KeyEvent.VK_TAB:
            selectedIndex++;
            if (selectedIndex == segments.length) {
                selectedIndex = 0;
            }
            requestRepaint();
            break;
        case KeyEvent.VK_LEFT:
        case KeyEvent.VK_UP:
            selectedIndex--;
            if (selectedIndex < 0) {
                selectedIndex = segments.length - 1;
            }
            requestRepaint();
            break;
        case KeyEvent.VK_HOME:
            selectedIndex = 0;
            requestRepaint();
            break;
        case KeyEvent.VK_END:
            selectedIndex = segments.length - 1;
            requestRepaint();
            break;
        default:
            int mods = e.getModifiersEx();
            for (int x = 0; x < stopEvents.length; x++) {
                if (stopEvents[x].getKeyCode() == code &&
                        (stopEvents[x].getModifiers() & mods) == stopEvents[x].getModifiers()) {
                    releaseUI(false);
                    consumeEvent = false;
                    break;
                }
            }
            for (int x = 0; x < confirmEvents.length; x++) {
                if (confirmEvents[x].getKeyCode() == code &&
                        (confirmEvents[x].getModifiers() & mods) == confirmEvents[x].getModifiers()) {
                    releaseUI(true);
                    break;
                }
            }
    }
    if (consumeEvent) {
        e.consume();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:61,代码来源:MethodChooser.java

示例10: keyPressed

@Override
public void keyPressed(KeyEvent e) {
	if (this.pane == null) {
		if (e.getSource() instanceof ItemPanel) {
			this.pane = ((ItemPanel) e.getSource());
		} else if (e.getSource() instanceof Item) {
			this.pane = ((ItemPanel) ((JComponent) e.getSource()).getParent());
		}
	}

	if (e.getKeyCode() == KeyEvent.VK_DELETE) {
	} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
		if ((this.pane != null) && (this.pane.getFilePane().lastSelected != null)) {
			this.pane.getFilePane().filechooserUI.setCurrentDirectoryOfFileChooser(this.pane.getFilePane().lastSelected
					.getFile());
		}
	} else if (e.getKeyCode() == KeyEvent.VK_SPACE) {
		this.pane.useKeyMoves("SPACE", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK);
	} else if (e.getKeyCode() == KeyEvent.VK_RIGHT) {
		this.pane.useKeyMoves("RIGHT", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK);
	} else if (e.getKeyCode() == KeyEvent.VK_LEFT) {
		this.pane.useKeyMoves("LEFT", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK);
	} else if (e.getKeyCode() == KeyEvent.VK_UP) {
		this.pane.useKeyMoves("UP", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK);
	} else if (e.getKeyCode() == KeyEvent.VK_DOWN) {
		this.pane.useKeyMoves("DOWN", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK);
	} else if (e.getKeyCode() == KeyEvent.VK_HOME) {
		this.pane.useKeyMoves("HOME", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK);
	} else if (e.getKeyCode() == KeyEvent.VK_END) {
		this.pane.useKeyMoves("END", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK);
	} else if (e.getKeyCode() == KeyEvent.VK_ENTER) {
		// ignore enter here!
	} else if (e.getKeyCode() == KeyEvent.VK_PAGE_UP) {
		this.pane.useKeyMoves("PAGE_UP", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK);
	} else if (e.getKeyCode() == KeyEvent.VK_PAGE_DOWN) {
		this.pane.useKeyMoves("PAGE_DOWN", e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK);
	} else {
		if (KeyEvent.getKeyText(e.getKeyCode()).toLowerCase().equals("a")
				&& (e.getModifiersEx() == InputEvent.CTRL_DOWN_MASK)) {
			this.pane.getFilePane().selectAll();
		}
		if (e.getModifiersEx() == 0) {
			this.pane.forwardToNearestFor(String.valueOf(e.getKeyChar()).toLowerCase());
		}
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:46,代码来源:ItemPanelKeyboardListener.java

示例11: keyEventGetKeyText

public static String keyEventGetKeyText(int keycode) {
    if (keycode == KeyEvent.VK_TAB) {
        return "Tab";
    }
    if (keycode == KeyEvent.VK_CONTROL) {
        return "Ctrl";
    }
    if (keycode == KeyEvent.VK_ALT) {
        return "Alt";
    }
    if (keycode == KeyEvent.VK_SHIFT) {
        return "Shift";
    }
    if (keycode == KeyEvent.VK_META) {
        return "Meta";
    }
    if (keycode == KeyEvent.VK_SPACE) {
        return "Space";
    }
    if (keycode == KeyEvent.VK_BACK_SPACE) {
        return "Backspace";
    }
    if (keycode == KeyEvent.VK_HOME) {
        return "Home";
    }
    if (keycode == KeyEvent.VK_END) {
        return "End";
    }
    if (keycode == KeyEvent.VK_DELETE) {
        return "Delete";
    }
    if (keycode == KeyEvent.VK_PAGE_UP) {
        return "Pageup";
    }
    if (keycode == KeyEvent.VK_PAGE_DOWN) {
        return "Pagedown";
    }
    if (keycode == KeyEvent.VK_UP) {
        return "Up";
    }
    if (keycode == KeyEvent.VK_DOWN) {
        return "Down";
    }
    if (keycode == KeyEvent.VK_LEFT) {
        return "Left";
    }
    if (keycode == KeyEvent.VK_RIGHT) {
        return "Right";
    }
    if (keycode == KeyEvent.VK_ENTER) {
        return "Enter";
    }
    return KeyEvent.getKeyText(keycode);
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:54,代码来源:OSUtils.java

示例12: keyPressed

@Override
public void keyPressed(KeyEvent e) {
	int cols = hex.getMeasures().getColumnCount();
	int rows;
	boolean shift = (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0;
	switch (e.getKeyCode()) {
	case KeyEvent.VK_UP:
		if (cursor >= cols)
			setDot(cursor - cols, shift);
		break;
	case KeyEvent.VK_LEFT:
		if (cursor >= 1)
			setDot(cursor - 1, shift);
		break;
	case KeyEvent.VK_DOWN:
		if (cursor >= hex.getModel().getFirstOffset() && cursor <= hex.getModel().getLastOffset() - cols) {
			setDot(cursor + cols, shift);
		}
		break;
	case KeyEvent.VK_RIGHT:
		if (cursor >= hex.getModel().getFirstOffset() && cursor <= hex.getModel().getLastOffset() - 1) {
			setDot(cursor + 1, shift);
		}
		break;
	case KeyEvent.VK_HOME:
		if (cursor >= 0) {
			int dist = (int) (cursor % cols);
			if (dist == 0)
				setDot(0, shift);
			else
				setDot(cursor - dist, shift);
			break;
		}
	case KeyEvent.VK_END:
		if (cursor >= 0) {
			HexModel model = hex.getModel();
			long dest = (cursor / cols * cols) + cols - 1;
			if (model != null) {
				long end = model.getLastOffset();
				if (dest > end || dest == cursor)
					dest = end;
				setDot(dest, shift);
			} else {
				setDot(dest, shift);
			}
		}
		break;
	case KeyEvent.VK_PAGE_DOWN:
		rows = hex.getVisibleRect().height / hex.getMeasures().getCellHeight();
		if (rows > 2)
			rows--;
		if (cursor >= 0) {
			long max = hex.getModel().getLastOffset();
			if (cursor + rows * cols <= max) {
				setDot(cursor + rows * cols, shift);
			} else {
				long n = cursor;
				while (n + cols < max)
					n += cols;
				setDot(n, shift);
			}
		}
		break;
	case KeyEvent.VK_PAGE_UP:
		rows = hex.getVisibleRect().height / hex.getMeasures().getCellHeight();
		if (rows > 2)
			rows--;
		if (cursor >= rows * cols)
			setDot(cursor - rows * cols, shift);
		else if (cursor >= cols)
			setDot(cursor % cols, shift);
		break;
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:74,代码来源:Caret.java

示例13: keyPressed

@Override
public void keyPressed(KeyEvent e) {
	if (cursorRow < 0)
		return;
	TruthTable model = table.getTruthTable();
	int rows = model.getRowCount();
	int inputs = model.getInputColumnCount();
	int outputs = model.getOutputColumnCount();
	int cols = inputs + outputs;
	boolean shift = (e.getModifiersEx() & InputEvent.SHIFT_DOWN_MASK) != 0;
	switch (e.getKeyCode()) {
	case KeyEvent.VK_UP:
		setCursor(cursorRow - 1, cursorCol, shift);
		break;
	case KeyEvent.VK_LEFT:
		setCursor(cursorRow, cursorCol - 1, shift);
		break;
	case KeyEvent.VK_DOWN:
		setCursor(cursorRow + 1, cursorCol, shift);
		break;
	case KeyEvent.VK_RIGHT:
		setCursor(cursorRow, cursorCol + 1, shift);
		break;
	case KeyEvent.VK_HOME:
		if (cursorCol == 0)
			setCursor(0, 0, shift);
		else
			setCursor(cursorRow, 0, shift);
		break;
	case KeyEvent.VK_END:
		if (cursorCol == cols - 1)
			setCursor(rows - 1, cols - 1, shift);
		else
			setCursor(cursorRow, cols - 1, shift);
		break;
	case KeyEvent.VK_PAGE_DOWN:
		rows = table.getVisibleRect().height / table.getCellHeight();
		if (rows > 2)
			rows--;
		setCursor(cursorRow + rows, cursorCol, shift);
		break;
	case KeyEvent.VK_PAGE_UP:
		rows = table.getVisibleRect().height / table.getCellHeight();
		if (rows > 2)
			rows--;
		setCursor(cursorRow - rows, cursorCol, shift);
		break;
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:49,代码来源:TableTabCaret.java

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