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


Java KeyEvent.VK_BACK_SPACE属性代码示例

本文整理汇总了Java中java.awt.event.KeyEvent.VK_BACK_SPACE属性的典型用法代码示例。如果您正苦于以下问题:Java KeyEvent.VK_BACK_SPACE属性的具体用法?Java KeyEvent.VK_BACK_SPACE怎么用?Java KeyEvent.VK_BACK_SPACE使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.awt.event.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.VK_BACK_SPACE属性的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: calibrationPanelKeyPressed

private void calibrationPanelKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_calibrationPanelKeyPressed
    switch (evt.getKeyCode()) {
        case KeyEvent.VK_SPACE:
            // send a message with pantilt and mouse filled in, tracker will fill in retina if there is a tracked locaton
            support.firePropertyChange(Message.AddSample.name(), null, new PanTiltCalibrationPoint(new Point2D.Float(), (Point2D.Float)lastPanTilt.clone(), (Point)lastMousePressLocation.clone()));
            repaint();
            return;
        case KeyEvent.VK_ENTER:
            support.firePropertyChange(Message.ComputeCalibration.name(), null, null);
            dispose();
            break;
        case KeyEvent.VK_BACK_SPACE:
            support.firePropertyChange(Message.EraseLastSample.name(), null, null);
            repaint();
            break;
        default:
            Toolkit.getDefaultToolkit().beep();
    }
}
 
开发者ID:SensorsINI,项目名称:jaer,代码行数:19,代码来源:PanTiltCalibrationGUI.java

示例3: type

protected synchronized void type(KeyEvent e)
{
    if(e.getKeyCode() == KeyEvent.VK_BACK_SPACE)
    {
        this.setText(remove(cursorIndex-1,getText()));
        cursorIndex--;
        if(cursorIndex < 0)
            cursorIndex = 0;
    }
    else
    {
        this.setText(insert(e.getKeyChar(),cursorIndex,getText()));
        cursorIndex++;
        
    }
}
 
开发者ID:AutonomousCarProject,项目名称:AutonomousCar,代码行数:16,代码来源:TextBox.java

示例4: handleCodeKey

/**
 * 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();
    }        
}
 
开发者ID:Skypr,项目名称:BEAST,代码行数:24,代码来源:CodeInputHandler.java

示例5: 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

示例6: getButton

private Button getButton(KeyEvent e) {
    switch (e.getKeyCode()) {
        case KeyEvent.VK_LEFT:
            return Button.LEFT;

        case KeyEvent.VK_RIGHT:
            return Button.RIGHT;

        case KeyEvent.VK_UP:
            return Button.UP;

        case KeyEvent.VK_DOWN:
            return Button.DOWN;

        case KeyEvent.VK_Z:
            return Button.A;

        case KeyEvent.VK_X:
            return Button.B;

        case KeyEvent.VK_ENTER:
            return Button.START;

        case KeyEvent.VK_BACK_SPACE:
            return Button.SELECT;
    }
    return null;
}
 
开发者ID:trekawek,项目名称:coffee-gb,代码行数:28,代码来源:SwingController.java

示例7: getKeyEvent

public int getKeyEvent(String key) {
    switch (key.toUpperCase()) {
        case "TAB":
            return KeyEvent.VK_TAB;
        case "ENTER":
            return KeyEvent.VK_ENTER;
        case "SHIFT":
            return KeyEvent.VK_SHIFT;
        case "CTRL":
            return KeyEvent.VK_CONTROL;
        case "ALT":
            return KeyEvent.VK_ALT;
        case "START":
            return KeyEvent.VK_WINDOWS;
        case "DELETE":
            return KeyEvent.VK_DELETE;
        case "BACKSPACE":
            return KeyEvent.VK_BACK_SPACE;
        case "HOME":
            return KeyEvent.VK_HOME;
        case "PAGE_UP":
        case "PAGEUP":
            return KeyEvent.VK_PAGE_UP;
        case "PAGE_DOWN":
        case "PAGEDOWN":
            return KeyEvent.VK_PAGE_DOWN;
        case "UP":
            return KeyEvent.VK_UP;
        case "DOWN":
            return KeyEvent.VK_DOWN;
        case "LEFT":
            return KeyEvent.VK_LEFT;
        case "RIGHT":
            return KeyEvent.VK_RIGHT;
        default:
            return KeyEvent.VK_ESCAPE;
    }
}
 
开发者ID:CognizantQAHub,项目名称:Cognizant-Intelligent-Test-Scripter,代码行数:38,代码来源:ImageCommand.java

示例8: listOfListsKeyPressed

private void listOfListsKeyPressed(
    java.awt.event.KeyEvent evt) {//GEN-FIRST:event_listOfListsKeyPressed
    if ((evt.getKeyCode() == KeyEvent.VK_DELETE || evt.getKeyCode() == KeyEvent.VK_BACK_SPACE)
        && listOfLists.getSelectedIndex() != -1) {
        if (JOptionPane.showConfirmDialog(this,
            locMes("del1") + " \"" + ((DefaultListModel) (listOfLists.getModel()))
                .get(listOfLists.getSelectedIndex()) + "\"?", locMes("del2"),
            JOptionPane.YES_NO_OPTION, JOptionPane.QUESTION_MESSAGE)
            != JOptionPane.YES_OPTION) {
            return;
        }
        ((DefaultListModel) (listOfLists.getModel())).remove(listOfLists.getSelectedIndex());
        saveState();
    }
}
 
开发者ID:bcgov,项目名称:sbc-qsystem,代码行数:15,代码来源:PComplexService.java

示例9: keyPressed

@Override
public void keyPressed(Canvas canvas, KeyEvent event) {
	switch (event.getKeyCode()) {
	case KeyEvent.VK_BACK_SPACE:
		if (lastAction != null && canvas.getProject().getLastAction() == lastAction) {
			canvas.getProject().undoAction();
			lastAction = null;
		}
	}
}
 
开发者ID:LogisimIt,项目名称:Logisim,代码行数:10,代码来源:WiringTool.java

示例10: 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

示例11: getTextForKeyChar

public static String getTextForKeyChar(char keyChar) {
    int keycode;
    switch (keyChar) {
    case ' ':
        keycode = KeyEvent.VK_SPACE;
        break;
    case '\b':
        keycode = KeyEvent.VK_BACK_SPACE;
        break;
    case '\t':
        keycode = KeyEvent.VK_TAB;
        break;
    case '\n':
        keycode = KeyEvent.VK_ENTER;
        break;
    case '\u0018':
        keycode = KeyEvent.VK_CANCEL;
        break;
    case '\u001b':
        keycode = KeyEvent.VK_ESCAPE;
        break;
    case '\u007f':
        keycode = KeyEvent.VK_DELETE;
        break;
    default:
        return "" + keyChar;
    }
    return (String) keyCodes.get(Integer.valueOf(keycode));
}
 
开发者ID:jalian-systems,项目名称:marathonv5,代码行数:29,代码来源:KeyStrokeParser.java

示例12: keyPressed

public void keyPressed(KeyEvent e) {
  switch (e.getKeyCode()) {
    case KeyEvent.VK_DELETE:
    case KeyEvent.VK_BACK_SPACE:
      setValue(null);
      break;
    case KeyEvent.VK_SHIFT:
    case KeyEvent.VK_CONTROL:
    case KeyEvent.VK_META:
    case KeyEvent.VK_ALT:
      break;
    default:
      setValue(KeyStroke.getKeyStrokeForEvent(e));
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:15,代码来源:HotKeyConfigurer.java

示例13: keyPressed

public void keyPressed(KeyEvent e) {
  switch (e.getKeyCode()) {
    case KeyEvent.VK_DELETE:
    case KeyEvent.VK_BACK_SPACE:
      setValue(NamedKeyStroke.NULL_KEYSTROKE);
      break;
    case KeyEvent.VK_SHIFT:
    case KeyEvent.VK_CONTROL:
    case KeyEvent.VK_META:
    case KeyEvent.VK_ALT:
      break;
    default:
      final NamedKeyStroke namedStroke = getValueNamedKeyStroke();
      if (namedStroke != null) {
        final int thisChar = e.getKeyChar();
        if (isPrintableAscii(lastChar) && isPrintableAscii(thisChar)) {
          final String name = "" + lastChar + e.getKeyChar();
          named = true;
          keyName.setText(name);
          setValue(new NamedKeyStroke(name));
          updateVisibility();
          keyName.requestFocus();
          break;
        }
      }
      setValue(NamedKeyStroke.getKeyStrokeForEvent(e));
  }
}
 
开发者ID:ajmath,项目名称:VASSAL-src,代码行数:28,代码来源:NamedHotKeyConfigurer.java

示例14: 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

示例15: testSimple3

public void testSimple3() throws Exception {
    KeyEvent ke = new KeyEvent(new JFrame(), KeyEvent.KEY_PRESSED, 0, 0, KeyEvent.VK_BACK_SPACE, '\0');
    performTest("package test; public class Test { public void test() {int a|bc = 0; int y = abc; } }", 83 - 22 - 1, ke, "package test; public class Test { public void test() {int ac = 0; int y = ac; } }", true);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:4,代码来源:InstantRenamePerformerTest.java


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