public synchronized void changedUpdate(DocumentEvent e) { documentChanged(); }
@Override protected ValidationResult validateDocument() { try { Pattern.compile(getText()); return ValidationResult.PASSED; } catch (PatternSyntaxException e) { return new ValidationResult(e); } } }
@Override protected ValidationResult validateDocument() { try { Integer.parseInt(getText()) ; return ValidationResult.PASSED ; } catch (NumberFormatException e) { return new ValidationResult(e) ; } }
/** * Constructs a FloatField with the default values and initialized with a * value. * * @param value * The intitial float value the field will display. * @param enabled * Indicates if the field should initially be enabled for * editing. */ public FloatField(float value, boolean enabled) { super(11); setDocument(new TexCoordDocument()); formatter = new DecimalFormat(); formatter.setMaximumFractionDigits(6); formatter.setMinimumFractionDigits(1); formatter.setMaximumIntegerDigits(6); formatter.setDecimalSeparatorAlwaysShown(true); formatter.setGroupingUsed(false); setValue(value); setEnabled(enabled); }
/** * Constructs a FloatField with the default values and initialized to 0.0. */ public FloatField() { super(11); setDocument(new TexCoordDocument()); formatter = new DecimalFormat(); formatter.setMaximumFractionDigits(6); formatter.setMinimumFractionDigits(1); formatter.setMaximumIntegerDigits(6); formatter.setDecimalSeparatorAlwaysShown(true); formatter.setGroupingUsed(false); setValue(0.0f); }
/** * This method is overridden from the base class to call a validation method * when the document changes. */ @Override protected void documentChanged() { ValidationResult result = validateDocument(); if (result == null) { throw new NullPointerException("Validation result may not be null"); } if (result.passed) { validationPassed(); } else { validationFailed(result.message); } }
@Override protected ValidationResult validateDocument() { ValidationResult validationResult = super.validateDocument(); if (ValidationResult.PASSED.equals(validationResult)) { int value = Integer.parseInt(getText()); if ((value < 8) || (value > 24)) { String failMessage; try { failMessage = resources .getMessage("nu.zoom.catonine.fontchooser.setting.size.validation"); } catch (ResourceNotFoundException e) { failMessage = "Font size out of range"; } validationResult = new ValidationResult(failMessage); } } return validationResult; }
@Override protected void validationPassed() { super.validationPassed(); // Is there a selected style rule? Document might change even if // there is no active style rule (for example from "unset". if (styleRule != null) { styleRule.setPattern(getText()); } } }
@Override protected void validationFailed(String message) { if (defaultToolTipText == null) { defaultToolTipText = getToolTipText(); } setToolTipText(message); fieldLabel.setToolTipText(message); fieldLabel.setForeground(Color.RED); }
public DocumentListeningField(String text, int columns) { super(text, columns); getDocument().addDocumentListener(this); }
@Override protected void validationPassed() { setToolTipText(defaultToolTipText); fieldLabel.setToolTipText(defaultToolTipText); defaultToolTipText = null; fieldLabel.setForeground(okForegroundColor); }
/** * Constructs a FloatField with the default values and initialized with a * value. * * @param value * The intitial float value the field will display. */ public FloatField(float value) { super(11); setDocument(new TexCoordDocument()); formatter = new DecimalFormat(); formatter.setMaximumFractionDigits(6); formatter.setMinimumFractionDigits(1); formatter.setMaximumIntegerDigits(6); formatter.setDecimalSeparatorAlwaysShown(true); formatter.setGroupingUsed(false); setValue(value); }
@Override protected void validationPassed() { super.validationPassed(); list.setLogBlockPattern(Pattern.compile(getText())); }
public DocumentListeningField(String text) { super(text); getDocument().addDocumentListener(this); }
public synchronized void insertUpdate(DocumentEvent e) { documentChanged(); }
@Override protected void validationPassed() { super.validationPassed(); // Is there a selected style rule? Document might change even if // there is no active style rule (for example from "unset". if (styleRule != null) { styleRule.setPattern(getText()); } } }
public DocumentListeningField() { super(); getDocument().addDocumentListener(this); }
public synchronized void removeUpdate(DocumentEvent e) { documentChanged(); }
public DocumentListeningField(Document doc, String text, int columns) { super(doc, text, columns); getDocument().addDocumentListener(this); }
public DocumentListeningField(int columns) { super(columns); getDocument().addDocumentListener(this); }