本文整理汇总了Java中java.awt.event.KeyEvent.VK_PAGE_UP属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.VK_PAGE_UP属性的具体用法?Java KeyEvent.VK_PAGE_UP怎么用?Java KeyEvent.VK_PAGE_UP使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.VK_PAGE_UP属性的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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;
}
}
示例2: 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;
}
示例3: 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();
}
示例4: 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());
}
}
}
示例5: 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);
}
示例6: 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;
}
}
示例7: 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;
}
}