List of usage examples for javax.swing JComponent setInputVerifier
@BeanProperty(description = "The component's input verifier.") public void setInputVerifier(InputVerifier inputVerifier)
From source file:org.esa.snap.ui.tooladapter.dialogs.ToolParameterEditorDialog.java
private JComponent addTextPropertyEditor(JPanel parent, String label, String propertyName, String value, int line, boolean isRequired) { parent.add(new JLabel(label), getConstraints(line, 0, 1)); PropertyDescriptor propertyDescriptor = container.getDescriptor(propertyName); TextFieldEditor textEditor = new TextFieldEditor(); JComponent editorComponent = textEditor.createEditorComponent(propertyDescriptor, valuesContext); ((JTextField) editorComponent).setText(value); if (isRequired) { editorComponent.setInputVerifier(new RequiredFieldValidator("This field is required")); }/* w ww .j a va 2 s .c o m*/ parent.add(editorComponent, getConstraints(line, 1, 1)); return editorComponent; }