本文整理汇总了Java中java.awt.event.KeyEvent.VK_DELETE属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.VK_DELETE属性的具体用法?Java KeyEvent.VK_DELETE怎么用?Java KeyEvent.VK_DELETE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类java.awt.event.KeyEvent
的用法示例。
在下文中一共展示了KeyEvent.VK_DELETE属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: keyPressed
@Override
public void keyPressed(Canvas canvas, KeyEvent e) {
if (state == MOVING && e.getKeyCode() == KeyEvent.VK_SHIFT) {
handleMoveDrag(canvas, curDx, curDy, e.getModifiersEx());
} else {
switch (e.getKeyCode()) {
case KeyEvent.VK_BACK_SPACE:
case KeyEvent.VK_DELETE:
if (!canvas.getSelection().isEmpty()) {
Action act = SelectionActions.clear(canvas.getSelection());
canvas.getProject().doAction(act);
e.consume();
}
break;
default:
processKeyEvent(canvas, e, KeyConfigurationEvent.KEY_PRESSED);
}
}
}
示例2: processKeyEvent
/**
* Processes key events.
*
* @param e key event.
*/
@Override
protected void processKeyEvent(KeyEvent e) {
int keyCode = e.getKeyCode();
if (keyCode == KeyEvent.VK_DELETE) {
if (!selection.isEmpty()) {
performAction(new DeleteComponentAction());
}
} else if ((keyCode == KeyEvent.VK_ESCAPE) && (moving || resizing)) {
// Cancel moving and resizing when Esc is pressed.
moving = false;
resizing = false;
repaint();
} else {
super.processKeyEvent(e);
}
}
示例3: keyCommand
/**
* Classes other than the Chatter itself may forward KeyEvents
* to the Chatter by using this method
*/
public void keyCommand(KeyStroke e) {
if ((e.getKeyCode() == 0 || e.getKeyCode() == KeyEvent.CHAR_UNDEFINED)
&& !Character.isISOControl(e.getKeyChar())) {
input.setText(input.getText() + e.getKeyChar());
}
else if (e.isOnKeyRelease()) {
switch (e.getKeyCode()) {
case KeyEvent.VK_ENTER:
if (input.getText().length() > 0)
send(formatChat(input.getText()));
input.setText(""); //$NON-NLS-1$
break;
case KeyEvent.VK_BACK_SPACE:
case KeyEvent.VK_DELETE:
String s = input.getText();
if (s.length() > 0)
input.setText(s.substring(0, s.length() - 1));
break;
}
}
}
示例4: keyTyped
@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);
}
}
}
示例5: keyPressed
public void keyPressed(KeyEvent e) {
if ((e.getKeyCode() == KeyEvent.VK_CONTEXT_MENU)
|| ((e.getKeyCode() == KeyEvent.VK_F10) && (e.getModifiers() == InputEvent.SHIFT_MASK))) {
int[] selectedRows = profilingPointsTable.getSelectedRows();
if (selectedRows.length != 0) {
Rectangle rowBounds = profilingPointsTable.getCellRect(selectedRows[0], 1, true);
showProfilingPointsPopup(e.getComponent(), rowBounds.x + 20,
rowBounds.y + (profilingPointsTable.getRowHeight() / 2));
}
} else if (e.getKeyCode() == KeyEvent.VK_DELETE) {
deletePPs();
}
}
示例6: keyPressed
@Override
public void keyPressed( KeyEvent e ) {
if (e.getSource() == lootLists) {
if (lootLists.getSelectedIndex() > - 1) {
if (e.getKeyCode() == KeyEvent.VK_DELETE || e.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
listModel.remove( lootLists.getSelectedIndex() );
updateLoots();
persistAndUpdate();
}
}
}
}
示例7: keyReleased
/**
*/
public void keyReleased (KeyEvent e) {
//if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug("Event: " + e); // NOI18N
if (e.getKeyCode() == KeyEvent.VK_DELETE) {
peer.remove (peer.get (table.getSelectedRow()));
tableModel.fireTableDataChanged();
}
}
示例8: keyReleased
/**
*/
public void keyReleased (KeyEvent e) {
//if ( Util.THIS.isLoggable() ) /* then */ Util.THIS.debug("Event: " + e); // NOI18N
if (e.getKeyCode() == KeyEvent.VK_DELETE) {
tableModel.removeRow (table.getSelectedRow());
// peer.remove (peer.get (table.getSelectedRow()));
// tableModel.fireTableDataChanged();
}
}
示例9: editCellAt
@Override
public boolean editCellAt(int i, int i1, EventObject e) {
Boolean flag = super.editCellAt(i, i1, e);
if (flag) {
if (e instanceof KeyEvent) {
int code = ((KeyEvent) e).getKeyCode();
if (code < KeyEvent.VK_DELETE
&& code >= KeyEvent.VK_COMMA) {
getEditorComponent().requestFocusInWindow();
}
}
}
return flag;
}
示例10: 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(); });
}
示例11: updateFilter
private void updateFilter(KeyEvent e) {
String filterText = getText();
if ((filterText == null) || (filterText.length() == 0)) {
if ((e == null)
|| ((e.getKeyCode() != KeyEvent.VK_BACK_SPACE) && (e.getKeyCode() != KeyEvent.VK_DELETE)
&& (e.getKeyCode() != KeyEvent.VK_SHIFT) && (e.getKeyCode() != KeyEvent.VK_ALT)
&& (e.getKeyCode() != KeyEvent.VK_ALT_GRAPH) && (e.getKeyCode() != KeyEvent.VK_CONTROL)
&& (e.getKeyCode() != KeyEvent.VK_META) && (!e.isActionKey()))) {
setText(null);
}
}
for (FilterListener l : filterListeners) {
l.valueChanged(filterText);
}
}
示例12: keyReleased
public void keyReleased(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_BACK_SPACE
|| e.getKeyCode() == KeyEvent.VK_DELETE) {
key = key.length() < 1 ? "" : key.substring(0, key.length() - 1);
}
else if (e.getKeyChar() != KeyEvent.CHAR_UNDEFINED) {
// key = tf.getText().trim().length() == 0 ?
// " " : key+(char)e.getKeyCode();
key += (char) e.getKeyCode();
}
}
示例13: handleNormalKey
/**
* Handle the keyboard events.
*
* @param key the key code
*/
private void handleNormalKey(int key) {
switch (key) {
case KeyEvent.VK_DELETE:
deleteObject();
break;
case KeyEvent.VK_A:
// move the box to the left
moveObject(-1, 0);
break;
case KeyEvent.VK_D:
// move the box to the right
moveObject(1, 0);
break;
case KeyEvent.VK_W:
// move the box up
moveObject(0, -1);
break;
case KeyEvent.VK_S:
// move the box down
moveObject(0, 1);
break;
default:
// do nothing
break;
}
}
示例14: isNumero
/**
* Metodo para verificar tipo do input
*
* @param input
* @return
*/
private boolean isNumero(char input) {
if ((input < '0' || input > '9')
&& (input != (char) KeyEvent.VK_PERIOD)
&& input != (char) KeyEvent.VK_ENTER
&& input != (char) KeyEvent.VK_BACK_SPACE
&& input != (char) KeyEvent.VK_DELETE) {
return false;
}
return true;
}
示例15: testSimple5
public void testSimple5() throws Exception {
KeyEvent ke = new KeyEvent(new JFrame(), KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_DELETE, '\0');
performTest("package test; public class Test { public void test() {int a|bc = 0; int y = abc; } }", 80 - 22, ke, "package test; public class Test { public void test() {int bc = 0; int y = bc; } }", true);
}