@Override public boolean verify(JComponent input) { JFormattedTextField ftf = (JFormattedTextField) input; return ftf.isEditValid(); } });
@Override public boolean verify(JComponent input) { JFormattedTextField ftf = (JFormattedTextField) input; return ftf.isEditValid(); } });
/** * Returns true if the current value being edited is valid. * * @return true if the current value being edited is valid. */ public boolean isEditValid() { return _dateField.isEditValid(); }
@Override public boolean verify(JComponent input) { JFormattedTextField ftf = (JFormattedTextField) input; return ftf.isEditValid(); } });
/** * Returns true if the current value being edited is valid. * * @return true if the current value being edited is valid. */ public boolean isEditValid() { return _dateField.isEditValid(); }
/** * Returns true if the current value being edited is valid. * * @return true if the current value being edited is valid. */ public boolean isEditValid() { return _dateField.isEditValid(); }
@Override public boolean verify(JComponent input) { JFormattedTextField ftf = (JFormattedTextField) input; return ftf.isEditValid(); } });
@Override public boolean verify(JComponent input) { JFormattedTextField ftf = (JFormattedTextField) input; return ftf.isEditValid(); } });
/** * Returns true if the current value being edited is valid. * * @return true if the current value being edited is valid. */ public boolean isEditValid() { return _dateField.isEditValid(); }
/** * Returns true if the current value being edited is valid. * * @return true if the current value being edited is valid. */ public boolean isEditValid() { return _dateField.isEditValid(); }
@Override public boolean verify(JComponent input) { JFormattedTextField ftf = (JFormattedTextField) input; return ftf.isEditValid(); } });
@Override public boolean verify(JComponent input) { JFormattedTextField ftf = (JFormattedTextField) input; return ftf.isEditValid(); } });
private void validate(JFormattedTextField source) { if (!source.isEditValid()) { // TODO: Need a better error message. JOptionPane.showMessageDialog(this, "Invalid input.", "Input Error", JOptionPane.ERROR_MESSAGE); source.requestFocusInWindow(); } }
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { delegate.setValue(value); if (((JFormattedTextField)editorComponent).isEditValid()) editorComponent.setBorder(editStateBorder); else editorComponent.setBorder(invalidStateBorder); return editorComponent; } }
public Component getTableCellEditorComponent(JTable table, Object value, boolean isSelected, int row, int column) { delegate.setValue(value); if (((JFormattedTextField)editorComponent).isEditValid()) editorComponent.setBorder(editStateBorder); else editorComponent.setBorder(invalidStateBorder); return editorComponent; } }
@Override public boolean stopCellEditing() { // If the user tries to tab out of the field, the textField will call stopCellEditing(). // Check for a valid edit, and don't let the focus leave until the edit is valid. if (!((JFormattedTextField) editorComponent).isEditValid()) return false; return super.stopCellEditing(); }
public boolean stopCellEditing() { if (field.isEditValid()) { try {field.commitEdit();} catch (ParseException ex) {} } else { field.setBorder(invalidStateBorder); return false; } return super.stopCellEditing(); } };
public boolean stopCellEditing() { if (field.isEditValid()) { try {field.commitEdit();} catch (ParseException ex) {} } else { field.setBorder(invalidStateBorder); return false; } return super.stopCellEditing(); } };
public boolean stopCellEditing() { if (field.isEditValid()) { try {field.commitEdit();} catch (ParseException ex) {} } else { field.setBorder(invalidStateBorder); return false; } return super.stopCellEditing(); } };
public void actionPerformed(ActionEvent e) { if (!ftf.isEditValid()) { // The text is invalid. if (userSaysRevert()) { // reverted ftf.postActionEvent(); // inform the editor } } else try { // The text is valid, ftf.commitEdit(); // so use it. ftf.postActionEvent(); // stop editing } catch (java.text.ParseException exc) { } } });