public void keyTyped(KeyEvent e) { char code = e.getKeyChar(); if (code == e.VK_ENTER) { // if (dataField != null) { e.setKeyChar(e.CHAR_UNDEFINED); e.setKeyCode(-1); // only fire this event, if the data has been changed if (textField.isDataChanged()) { fireActionPerformed("enter"); } // not shift + enter => focus to next if ((e.getModifiers() & e.SHIFT_MASK) != e.SHIFT_MASK) { this.changeFocusToNext(); } } } else { if (!TKeyLock.keys.isLocked()) { textField.setDataChanged(true); } } }
/** returns the status of data */ public boolean isDataChanged() { return textField.isDataChanged(); }