當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。