Search in sources :

Example 81 with DocumentAdapter

use of com.intellij.ui.DocumentAdapter in project azure-tools-for-java by Microsoft.

the class VirtualNetworkDialog method createUIComponents.

private void createUIComponents() {
    // todo: add name validator
    txtName = new ValidationDebouncedTextInput();
    txtName.setRequired(true);
    txtSubnetName = new ValidationDebouncedTextInput();
    txtSubnetName.setRequired(true);
    txtAddressSpace = new ValidationDebouncedTextInput();
    txtAddressSpace.setRequired(true);
    txtAddressSpace.setValidator(() -> validateSubnet(txtAddressSpace.getValue()));
    txtAddressSpace.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(@NotNull DocumentEvent e) {
            lblAddressSpaceDetails.setText(getSubnetInfo(txtAddressSpace.getValue()));
        }
    });
    txtSubnetAddressRange = new ValidationDebouncedTextInput();
    txtSubnetAddressRange.setRequired(true);
    txtSubnetAddressRange.setValidator(() -> validateSubnet(txtSubnetAddressRange.getValue()));
    txtSubnetAddressRange.getDocument().addDocumentListener(new DocumentAdapter() {

        @Override
        protected void textChanged(@NotNull DocumentEvent e) {
            lblSubnetAddressDetails.setText(getSubnetInfo(txtSubnetAddressRange.getValue()));
        }
    });
}
Also used : DocumentAdapter(com.intellij.ui.DocumentAdapter) DocumentEvent(javax.swing.event.DocumentEvent) ValidationDebouncedTextInput(com.microsoft.azure.toolkit.intellij.common.ValidationDebouncedTextInput)

Aggregations

DocumentAdapter (com.intellij.ui.DocumentAdapter)81 DocumentEvent (javax.swing.event.DocumentEvent)81 ActionEvent (java.awt.event.ActionEvent)15 ActionListener (java.awt.event.ActionListener)15 FileChooserDescriptor (com.intellij.openapi.fileChooser.FileChooserDescriptor)11 Document (javax.swing.text.Document)8 JTextComponent (javax.swing.text.JTextComponent)8 VirtualFile (com.intellij.openapi.vfs.VirtualFile)6 ItemEvent (java.awt.event.ItemEvent)6 ItemListener (java.awt.event.ItemListener)6 NotNull (org.jetbrains.annotations.NotNull)6 Nullable (org.jetbrains.annotations.Nullable)6 JBTextField (com.intellij.ui.components.JBTextField)5 ChangeEvent (javax.swing.event.ChangeEvent)5 Project (com.intellij.openapi.project.Project)4 FieldPanel (com.intellij.ui.FieldPanel)4 ChangeListener (javax.swing.event.ChangeListener)4 List (java.util.List)3 DocumentListener (javax.swing.event.DocumentListener)3 ProjectSelector (com.google.cloud.tools.intellij.project.ProjectSelector)2