public static JTextField addTextField(JPanel parent, TextFieldEditor textEditor, String labelText, PropertyContainer propertyContainer, BindingContext bindingContext, String propertyName, boolean isRequired) { parent.add(new JLabel(labelText)); PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName); if (isRequired) { propertyDescriptor.setValidator(new NotEmptyValidator()); } JComponent editorComponent = textEditor.createEditorComponent(propertyDescriptor, bindingContext); UIUtils.addPromptSupport(editorComponent, "enter " + labelText.toLowerCase().replace(":", "") + " here"); UIUtils.enableUndoRedo(editorComponent); parent.add(editorComponent); return (JTextField) editorComponent; }
JComponent addTextField(JPanel parent, TextFieldEditor textEditor, String labelText, String propertyName, boolean isRequired, String[] excludedChars) { JLabel jLabel = new JLabel(labelText); Dimension size = jLabel.getPreferredSize(); parent.add(jLabel); PropertyDescriptor propertyDescriptor = propertyContainer.getDescriptor(propertyName); if (isRequired) { propertyDescriptor.setValidator(new DecoratedNotEmptyValidator(jLabel, excludedChars)); jLabel.setMaximumSize(new Dimension(size.width + 20, size.height)); } JComponent editorComponent = textEditor.createEditorComponent(propertyDescriptor, bindingContext); UIUtils.addPromptSupport(editorComponent, "enter " + labelText.toLowerCase().replace(":", "") + " here"); UIUtils.enableUndoRedo(editorComponent); editorComponent.setPreferredSize(new Dimension(editorComponent.getPreferredSize().width, controlHeight)); editorComponent.setMaximumSize(new Dimension(editorComponent.getMaximumSize().width, controlHeight)); jLabel.setLabelFor(editorComponent); parent.add(editorComponent); return editorComponent; }
templateContent = new JTextArea("", 15, 9); UIUtils.enableUndoRedo(templateContent);
editorComponent.setMaximumSize(new Dimension(editorComponent.getMaximumSize().width, controlHeight)); editorComponent.setPreferredSize(new Dimension(editorComponent.getPreferredSize().width, controlHeight)); org.esa.snap.utils.UIUtils.enableUndoRedo(editorComponent); JLabel jLabel = new JLabel(Bundle.CTL_Label_ToolLocation_Text()); panelToolFiles.add(jLabel); editorComponent.setMaximumSize(new Dimension(editorComponent.getMaximumSize().width, controlHeight)); editorComponent.setPreferredSize(new Dimension(editorComponent.getPreferredSize().width, controlHeight)); org.esa.snap.utils.UIUtils.enableUndoRedo(editorComponent); jLabel = new JLabel(Bundle.CTL_Label_WorkDir_Text()); panelToolFiles.add(jLabel);