本文整理匯總了Java中java.awt.event.KeyEvent.isShiftDown方法的典型用法代碼示例。如果您正苦於以下問題:Java KeyEvent.isShiftDown方法的具體用法?Java KeyEvent.isShiftDown怎麽用?Java KeyEvent.isShiftDown使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.awt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.isShiftDown方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: handleCodeKey
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
/**
* takes the given key event and passes it on to the right method in
* userinserttocode. Ex: Enter key -> it calls enterNewline()
* @param ke the keyevent to be processed by userinserttocode
*/
public void handleCodeKey(KeyEvent ke) {
try{
if(ke.getKeyCode()== KeyEvent.VK_ENTER || ke.getKeyChar() == '\n') {
insertToCode.insertNewline();
} else if(ke.getKeyCode() == KeyEvent.VK_TAB || ke.getKeyChar() == '\t') {
if(ke.isShiftDown()) {
insertToCode.removeTab();
} else {
insertToCode.insertTab();
}
} else if(ke.getKeyCode() == KeyEvent.VK_BACK_SPACE || ke.getKeyChar() == '\b') {
insertToCode.removeToTheLeft();
} else if(ke.getKeyCode() == KeyEvent.VK_SPACE || ke.getKeyChar() != ''){
insertToCode.insertChar(ke.getKeyChar());
}
} catch(BadLocationException ex) {
ex.printStackTrace();
}
}
示例2: keyTyped
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
@Override
public void keyTyped(KeyEvent ke) {
if(ke.getKeyCode() == KeyEvent.VK_LEFT ||
ke.getKeyCode() == KeyEvent.VK_RIGHT ||
ke.getKeyCode() == KeyEvent.VK_UP ||
ke.getKeyCode() == KeyEvent.VK_DOWN) {
return;
}
if(pane.getSelectedText() != null ||
ke.getKeyChar()== KeyEvent.VK_DELETE ||
ke.getKeyChar()== KeyEvent.VK_BACK_SPACE ||
(ke.isShiftDown() && ke.getKeyChar() == KeyEvent.VK_TAB)) {
try {
prevText = pane.getStyledDocument().getText(0, pane.getStyledDocument().getLength());
} catch (BadLocationException ex) {
Logger.getLogger(SaveTextBeforeRemove.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
示例3: keyPressed
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
@Override
public void keyPressed(KeyEvent e) {
if(e.getKeyCode() == KeyEvent.VK_DOWN) {
selectOffsetMenuItem(+1);
}
if(e.getKeyCode() == KeyEvent.VK_UP) {
selectOffsetMenuItem(-1);
}
if(e.getKeyCode() == KeyEvent.VK_LEFT) {
selectOffsetMenu(-1);
}
if(e.getKeyCode() == KeyEvent.VK_RIGHT) {
selectOffsetMenu(+1);
}
if(e.getKeyCode() == KeyEvent.VK_SPACE) {
startEditing();
}
// #116961: start inplace editing when F2 key is pressed on a menu
if(e.getKeyCode() == KeyEvent.VK_F2) {
startEditing();
}
//we aren't getting tabs for some reason
if(e.getKeyCode() == KeyEvent.VK_A) {
if(e.isShiftDown()) {
selectNextMenuItem(-1);
} else {
selectNextMenuItem(+1);
}
}
}
示例4: keyPressed
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
@Override
public void keyPressed(KeyEvent e) {
if (e.isAltDown() || e.isAltGraphDown() ||
e.isControlDown() || e.isMetaDown() ||
e.isShiftDown()) {
setSelectCursor();
}
}
示例5: keyReleased
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
@Override
public void keyReleased(KeyEvent e) {
if (!(e.isAltDown() || e.isAltGraphDown() ||
e.isControlDown() || e.isMetaDown() ||
e.isShiftDown())) {
unsetSelectCursor();
}
}
示例6: keyTyped
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
/**
* Method declaration
*
*
* @param k
*/
public void keyTyped(KeyEvent k) {
// Strg+Enter or Shift+Enter executes the actual SQL statement in command panel
if (k.getKeyChar() == '\n'
&& (k.isControlDown() || k.isShiftDown())) {
k.consume();
execute();
layoutCard.show(pCard, "result");
}
}
示例7: adjustX
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
protected void adjustX(int direction, KeyEvent e) {
int delta = direction * DELTA;
if (e.isShiftDown()) {
delta *= FAST;
}
if (e.isControlDown()) {
delta *= FASTER;
}
int newX = myStack.pos.x + delta;
if (newX < 0) newX = 0;
if (newX >= board.getSize().getWidth()) newX = (int) board.getSize().getWidth() - 1;
myStack.pos.x = newX;
}
示例8: adjustY
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
protected void adjustY(int direction, KeyEvent e) {
int delta = direction * DELTA;
if (e.isShiftDown()) {
delta *= FAST;
}
if (e.isControlDown()) {
delta *= FASTER;
}
int newY = myStack.pos.y + delta;
if (newY < 0) newY = 0;
if (newY >= board.getSize().getHeight()) newY = (int) board.getSize().getHeight() - 1;
myStack.pos.y = newY;
}
示例9: keyPressed
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
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();
}
示例10: adjustDx
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
protected void adjustDx(int direction, KeyEvent e) {
double delta = direction * DDELTA;
if (e.isShiftDown()) {
delta *= FAST;
}
grid.setDx(grid.getDx() + delta);
}
示例11: adjustDy
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
protected void adjustDy(int direction, KeyEvent e) {
double delta = direction * DDELTA;
if (e.isShiftDown()) {
delta *= FAST;
}
grid.setDy(grid.getDy() + delta);
}
示例12: findActionName
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
public String findActionName(long emulatorID, KeyEvent event) {
int j = (int) emulatorID;
ActionTbl[] actionTbl = KEYS_TABLE[j];
for (int i = 0; actionTbl[i] != null; i++) {
if ((event.getKeyCode() == actionTbl[i].m_StdKeyCode)
&& (event.isControlDown() == actionTbl[i].m_StdKeyCtrl)
&& (event.isShiftDown() == actionTbl[i].m_StdKeyShft)
&& (event.isAltDown() == actionTbl[i].m_StdKeyAlt)) {
return (actionTbl[i].m_ActionName);
}
}
return null;
}
示例13: keyPressed
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
@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;
}
}
}
示例14: processKeyEvent
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
@Override
public void processKeyEvent(KeyEvent e) {
shift = (e.getKeyCode() == KeyEvent.VK_ENTER &&
e.getID() == KeyEvent.KEY_PRESSED && e.isShiftDown());
}
示例15: processKeyEvent
import java.awt.event.KeyEvent; //導入方法依賴的package包/類
public void processKeyEvent(KeyEvent e) {
shift = (e.getKeyCode() == KeyEvent.VK_ENTER && e.getID() == KeyEvent.KEY_PRESSED && e.isShiftDown());
}