本文整理汇总了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 ();
}
}
示例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();
}
}
示例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();
}
}
示例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(" ");
}
}
}
示例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();
}
}
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
示例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();
}
}
}
示例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);
}
}
示例13: keyPressed
public void keyPressed(KeyEvent e) {
if (e.getKeyCode() == KeyEvent.VK_ENTER) {
updateValues();
e.consume();
}
}
示例14: processKeyEvent
@Override
public void processKeyEvent(KeyEvent e) {
shift = (e.getKeyCode() == KeyEvent.VK_ENTER && e.getID() == KeyEvent.KEY_PRESSED && e.isShiftDown());
}
示例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();
}