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


Java KeyEvent.VK_DELETE属性代码示例

本文整理汇总了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);
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:19,代码来源:SelectTool.java

示例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);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:21,代码来源:GlassPane.java

示例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;
    }
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:25,代码来源:Chatter.java

示例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);
        }
    }        
}
 
开发者ID:Skypr,项目名称:BEAST,代码行数:20,代码来源:SaveTextBeforeRemove.java

示例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();
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ProfilingPointsWindowUI.java

示例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();
            }
        }
    }
}
 
开发者ID:lauriholmas,项目名称:batmapper,代码行数:12,代码来源:CorpsePanel.java

示例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();
          }
      }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:9,代码来源:TreeAttlistDeclAttributeListCustomizer.java

示例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();
            }
        }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:10,代码来源:TreeElementAttributeListCustomizer.java

示例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;
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:14,代码来源:XTable.java

示例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(); });
}
 
开发者ID:AdoptOpenJDK,项目名称:openjdk-jdk10,代码行数:27,代码来源:ModifierRobotEnhancedKeyTest.java

示例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);
	}
}
 
开发者ID:transwarpio,项目名称:rapidminer,代码行数:15,代码来源:FilterTextField.java

示例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();
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:11,代码来源:KeySpecifier.java

示例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;
    }
}
 
开发者ID:buni-rock,项目名称:Pixie,代码行数:36,代码来源:BoundingBoxWindow.java

示例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;
}
 
开发者ID:AlfredoSebastiao,项目名称:Metodo-de-Gaus-Com-Pivot,代码行数:18,代码来源:Tela.java

示例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);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:InstantRenamePerformerTest.java


注:本文中的java.awt.event.KeyEvent.VK_DELETE属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。