當前位置: 首頁>>代碼示例>>Java>>正文


Java KeyEvent.VK_ENTER屬性代碼示例

本文整理匯總了Java中java.awt.event.KeyEvent.VK_ENTER屬性的典型用法代碼示例。如果您正苦於以下問題:Java KeyEvent.VK_ENTER屬性的具體用法?Java KeyEvent.VK_ENTER怎麽用?Java KeyEvent.VK_ENTER使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在java.awt.event.KeyEvent的用法示例。


在下文中一共展示了KeyEvent.VK_ENTER屬性的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: keyPressed

public void keyPressed (KeyEvent e) {
    if ((e.getKeyCode () == KeyEvent.VK_ESCAPE && e.getModifiers () == 0) || 
        (e.getKeyCode () == KeyEvent.VK_ENTER  && e.getModifiers() == 0)
    ) {
        if (highlights == null) return;
        final List<Highlight> oldHighlights = highlights;
        SwingUtilities.invokeLater (new Runnable () {
            public void run () {
                Iterator<Highlight> it = oldHighlights.iterator ();
                while (it.hasNext ())
                    it.next ().remove ();
            }
        });
        editor.removeKeyListener (this);
        document.removeDocumentListener (this);
        highlights = null;
        elements = null;
        editor = null;
        document = null;
        renameImplementation = null;
         e.consume ();
    }    
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:23,代碼來源:InstantRenameAction.java

示例2: keyReleased

@Override
public void keyReleased(KeyEvent event) {
    super.keyPressed(event);
    if (!event.isConsumed() && event.getSource() == criteria.getSearchTextField() && event.getKeyChar() == KeyEvent.VK_ENTER) {
        event.consume();
        refreshData();
    }
}
 
開發者ID:CLARIN-PL,項目名稱:WordnetLoom,代碼行數:8,代碼來源:SynsetViewUI.java

示例3: 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,代碼來源:PanTiltGUI.java

示例4: jTextField_navMgrsKeyReleased

private void jTextField_navMgrsKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextField_navMgrsKeyReleased
    switch (evt.getKeyCode()) {
        case KeyEvent.VK_ESCAPE: {
            Utilities.closeApplication(app);
            break;
        }
        case KeyEvent.VK_ENTER: {
            jButton_navGoToMgrsActionPerformed(null);
            break;
        }
        default: {
            //Clear the error message
            jLabel_mgrsMessage.setText(" ");
        }
    }
}
 
開發者ID:Esri,項目名稱:defense-solutions-proofs-of-concept,代碼行數:16,代碼來源:MainMenuJPanel.java

示例5: keyPressed

public void keyPressed(KeyEvent e) {
    if (e.getKeyCode() == KeyEvent.VK_SPACE || e.getKeyCode() == KeyEvent.VK_ENTER ) {

        if ( e.getSource() instanceof JTree ) {
            JTree tree = (JTree) e.getSource();
            TreePath path = tree.getSelectionPath();

            if ( toggle( path )) {
                e.consume();
            }
        }
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:FmtSpaces.java

示例6: eDireccionKeyPressed

private void eDireccionKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_eDireccionKeyPressed
    // TODO add your handling code here:
    if(evt.getKeyCode() == KeyEvent.VK_ENTER)
    {
        eTelefono.requestFocus();
    }
}
 
開發者ID:JuanJoseFJ,項目名稱:ProyectoPacientes,代碼行數:7,代碼來源:JDEditar.java

示例7: ccKeyPressed

private void ccKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_ccKeyPressed
    // TODO add your handling code here:
    if(evt.getKeyCode() == KeyEvent.VK_ENTER)
    {
        ee.requestFocus();
    }
}
 
開發者ID:JuanJoseFJ,項目名稱:ProyectoPacientes,代碼行數:7,代碼來源:JDagEspecialidad.java

示例8: jTextVMOptionsKeyPressed

private void jTextVMOptionsKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_jTextVMOptionsKeyPressed
    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
        evt.consume();
    }
    if (evt.getKeyCode() == KeyEvent.VK_TAB) {
        if (evt.getModifiers() > 0) {
            jTextVMOptions.transferFocusBackward();
        } else {
            jTextVMOptions.transferFocus();
        }
        evt.consume();
    }
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:13,代碼來源:CustomizerRun.java

示例9: campoEmailKeyPressed

private void campoEmailKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_campoEmailKeyPressed
    if (evt.getKeyCode() == KeyEvent.VK_ENTER) {
        entrarComEnter();
    } else if (evt.getKeyCode() == KeyEvent.VK_ESCAPE) {
        dispose();
    }
}
 
開發者ID:lucas-dolsan,項目名稱:tcc-rpg,代碼行數:7,代碼來源:TelaRegistrar.java

示例10: txtApellidoKeyPressed

private void txtApellidoKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_txtApellidoKeyPressed
    // TODO add your handling code here:
            if(evt.getKeyCode() == KeyEvent.VK_ENTER)
    {
        btnBuscar.requestFocus();
    }

}
 
開發者ID:JuanJoseFJ,項目名稱:ProyectoPacientes,代碼行數:8,代碼來源:JDBuscarPacientes.java

示例11: keyReleased

/**
 * {@inheritDoc}
 */
@Override
public void keyReleased(final KeyEvent e) {
    final Object source = e.getSource();

    if (m_gui.isClassField(source)) {
        if (e.getKeyCode() == KeyEvent.VK_ENTER) {
            actionUserAddedClass();
        }
    }
}
 
開發者ID:knime,項目名稱:knime-activelearning,代碼行數:13,代碼來源:ActiveLearnLoopEndNodeViewListener.java

示例12: keyPressed

@Override
public void keyPressed(KeyEvent e)
{
	int code = e.getKeyCode();
	if( code == KeyEvent.VK_ENTER || code == KeyEvent.VK_SPACE )
	{
		JComponent c = (JComponent) e.getComponent();
		c.setForeground(mTextPressed);
		c.setBackground(mBackgroundPressed);
	}
}
 
開發者ID:equella,項目名稱:Equella,代碼行數:11,代碼來源:FlatterButtonUI.java

示例13: keyPressed

public void keyPressed(KeyEvent e) {
	if (e.getKeyCode() == KeyEvent.VK_ENTER) {
		updateValues();
		e.consume();
	}
}
 
開發者ID:max6cn,項目名稱:jmt,代碼行數:6,代碼來源:StationNamePanel.java

示例14: processKeyEvent

@Override
public void processKeyEvent(KeyEvent e) {
    shift = (e.getKeyCode() == KeyEvent.VK_ENTER && e.getID() == KeyEvent.KEY_PRESSED && e.isShiftDown());
}
 
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:4,代碼來源:HtmlCompletionItem.java

示例15: keyReleased

@Override
public void keyReleased(KeyEvent ke) {
  if (myField.getText() == null) {
    myField.setText("");
    field = myField.getText();
  }

  if (ke.getKeyCode() == KeyEvent.VK_DOWN) {
    if (myList.size() == 1) {
      myField.setText( myList.get(0));
    }
    else if (list.getSelectedIndex() < list.getModel().getSize() - 1) {
      list.setSelectedIndex(list.getSelectedIndex());
      myField.setText( (String) list.getSelectedItem());
    }
    field = myField.getText();
    myField.requestFocus();
    return;
  }
  else if (ke.getKeyCode() == KeyEvent.VK_UP) {
    if (list.getSelectedIndex() > 0) {
      list.setSelectedIndex(list.getSelectedIndex());
    }
    myField.setText( (String) list.getSelectedItem());
    field = myField.getText();
    return;
  }
  else if (ke.getKeyCode() == KeyEvent.VK_ENTER) {
    field = myField.getText();
    action.actionPerformed(new ActionEvent(add,
                                           ActionEvent.ACTION_PERFORMED,
                                           "add"));
    return;
  }
  else if (ke.getKeyCode() == KeyEvent.VK_BACK_SPACE) {
  }
  else if (Character.isJavaIdentifierPart(ke.getKeyChar()) ||
           Character.isSpaceChar(ke.getKeyChar()) ||
           Character.isDefined(ke.getKeyChar())) {
  }
  else {
    return;
  }

  String startWith = myField.getText();
  myList = new Vector<String>();
  ArrayList<String> set = new ArrayList<String>(currentSelections.keySet());
  Collections.sort(set);
  set.add(0, "[New Chain]");
  boolean first = true;
  for (int i = 0; i < set.size(); i++) {
    String currString = set.get(i);
    if (currString.toLowerCase().startsWith(startWith.toLowerCase())) {
      if (first) {
        myField.setText(currString.substring(0, startWith.length()));
        first = false;
      }
      myList.add(currString);
    }
  }
  ComboBoxModel<String> model = new DefaultComboBoxModel<String>(myList);
  list.setModel(model);
  myField.setText(startWith);
  field = myField.getText();
  list.showPopup();
}
 
開發者ID:GateNLP,項目名稱:gate-core,代碼行數:66,代碼來源:CorefEditor.java


注:本文中的java.awt.event.KeyEvent.VK_ENTER屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。