本文整理汇总了Java中java.awt.event.KeyEvent.isAltDown方法的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.isAltDown方法的具体用法?Java KeyEvent.isAltDown怎么用?Java KeyEvent.isAltDown使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类java.awt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.isAltDown方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyPressed
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@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);
}
}
示例2: dispatchKeyGeneral
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
/**
* Handles the keys which have to be enabled all the time in the frame.
*/
private void dispatchKeyGeneral(KeyEvent e) {
int eventId = e.getID();
int key = e.getKeyCode();
handleCloseDialogKeys(key);
// if the object is the preview of the scribble object, no edit can be done for the it
if (currentObject instanceof ObjectScribble) {
return;
}
if (eventId == KeyEvent.KEY_PRESSED) {
if (e.isControlDown()) {
handleCtrlKey(key);
} else if (e.isAltDown()) {
handleAltKey(key);
} else {
handleNormalKey(key);
}
}
}
示例3: dispatchKeyGeneral
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
/**
* Handles the keys which have the same functionality for all the types
* of labeling.
*/
private void dispatchKeyGeneral(KeyEvent e) {
int eventId = e.getID();
int key = e.getKeyCode();
// the mapping of the keys is based on the default assignment of keys for UGEE graphic tablet
if (eventId == KeyEvent.KEY_PRESSED) {
if (e.isControlDown()) {
handleCtrlKey(key);
} else if (e.isAltDown()) {
handleAltKey(key);
} else {
handleNormalKey(key);
}
}
}
示例4: handleKeyPress
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
public void handleKeyPress(KeyEvent e) {
if( e.isAltDown() ) {
int code = e.getKeyCode();
switch(code) {
// diagram pane
case KeyEvent.VK_1:
if ( DEBUG )
System.out.println(" Alt + 1 pressed. "); // NOI18N
// ToDo: Decide whether this needs to be duplicated in the GraphLib version
// _queryBuilderPane.getQueryBuilderGraphFrame().getFocus ();
getGraphFrameCanvasFocus();
break;
// grid pane
case KeyEvent.VK_2:
if ( DEBUG )
System.out.println(" Alt + 2 pressed. "); // NOI18N
if ( _queryBuilderPane.getQueryBuilderInputTable().getRowCount() > 0 ) {
_queryBuilderPane.getQueryBuilderInputTable().setRowSelectionInterval(0, 0);
_queryBuilderPane.getQueryBuilderInputTable().requestFocus( true );
}
break;
// SQL text pane
case KeyEvent.VK_3:
if ( DEBUG )
System.out.println(" Alt + 3 pressed. "); // NOI18N
_queryBuilderPane.getQueryBuilderSqlTextArea().requestFocus( true );
break;
// Result Pane
case KeyEvent.VK_4:
if ( DEBUG )
System.out.println(" Alt + 4 pressed. "); // NOI18N
_queryBuilderPane.getQueryBuilderResultTable().requestFocus( true );
break;
}
}
}
示例5: 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();
}
}
示例6: 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();
}
}
示例7: recordRawKeyEvent
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override public void recordRawKeyEvent(RComponent r, KeyEvent e) {
JSONObject event = new JSONObject();
event.put("type", "key_raw");
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_META || keyCode == KeyEvent.VK_SHIFT || keyCode == KeyEvent.VK_ALT
|| keyCode == KeyEvent.VK_CONTROL) {
return;
}
if ((e.isActionKey() || e.isControlDown() || e.isMetaDown() || e.isAltDown()) && e.getID() == KeyEvent.KEY_PRESSED) {
String mtext = buildModifiersText(e);
event.put("modifiersEx", mtext);
KeysMap keysMap = KeysMap.findMap(e.getKeyCode());
if (keysMap == KeysMap.NULL) {
return;
}
String keyText;
if (keysMap == null) {
keyText = KeyEvent.getKeyText(e.getKeyCode());
} else {
keyText = keysMap.toString();
}
event.put("keyCode", keyText);
} else if (e.getID() == KeyEvent.KEY_TYPED && !e.isControlDown()) {
if (Character.isISOControl(e.getKeyChar()) && hasMapping(e.getKeyChar())) {
event.put("keyChar", getMapping(e.getKeyChar()));
} else {
event.put("keyChar", "" + e.getKeyChar());
}
} else {
return;
}
recordEvent(r, event);
}
示例8: 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;
}
示例9: getKeyListener
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
private KeyListener getKeyListener() {
KeyAdapter listener = new KeyAdapter() {
@Override
public void keyTyped(KeyEvent e) {
char c = e.getKeyChar();
if(Character.isLetter(c) && !e.isAltDown()) {
e.consume();
}
}
};
return listener;
}
示例10: handleJavaKeyEvent
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
public boolean handleJavaKeyEvent(KeyEvent e) {
switch (e.getID()) {
case KeyEvent.KEY_TYPED:
if ((e.getKeyChar() == '\n') && !e.isAltDown() && !e.isControlDown()) {
postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
getText(), e.getWhen(), e.getModifiers()));
return true;
}
break;
}
return false;
}
示例11: handleJavaKeyEvent
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
@Override
@SuppressWarnings("deprecation")
public boolean handleJavaKeyEvent(KeyEvent e) {
switch (e.getID()) {
case KeyEvent.KEY_TYPED:
if ((e.getKeyChar() == '\n') && !e.isAltDown() && !e.isControlDown()) {
postEvent(new ActionEvent(target, ActionEvent.ACTION_PERFORMED,
getText(), e.getWhen(), e.getModifiers()));
return true;
}
break;
}
return false;
}
示例12: postProcessKeyEvent
import java.awt.event.KeyEvent; //导入方法依赖的package包/类
public boolean postProcessKeyEvent(KeyEvent ev) {
if(ev.isConsumed() && ev.getKeyCode() != KeyEvent.VK_ALT) {
// mnemonic combination, it's consumed, but we need
// set altKeyPressed to false, otherwise after selection
// component by mnemonic combination a menu will be open
altKeyPressed = false;
return false;
}
if (ev.getKeyCode() == KeyEvent.VK_ALT) {
root = SwingUtilities.getRootPane(ev.getComponent());
winAncestor = (root == null ? null :
SwingUtilities.getWindowAncestor(root));
if (ev.getID() == KeyEvent.KEY_PRESSED) {
if (!altKeyPressed) {
altPressed(ev);
}
altKeyPressed = true;
return true;
} else if (ev.getID() == KeyEvent.KEY_RELEASED) {
if (altKeyPressed) {
altReleased(ev);
} else {
MenuSelectionManager msm =
MenuSelectionManager.defaultManager();
MenuElement[] path = msm.getSelectedPath();
if (path.length <= 0) {
WindowsLookAndFeel.setMnemonicHidden(true);
WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
}
}
altKeyPressed = false;
}
root = null;
winAncestor = null;
} else {
if (WindowsLookAndFeel.isMnemonicHidden() && ev.isAltDown()) {
WindowsLookAndFeel.setMnemonicHidden(false);
WindowsGraphicsUtils.repaintMnemonicsInWindow(winAncestor);
}
altKeyPressed = false;
}
return false;
}