当前位置: 首页>>代码示例>>Java>>正文


Java DocumentListener类代码示例

本文整理汇总了Java中javax.swing.event.DocumentListener的典型用法代码示例。如果您正苦于以下问题:Java DocumentListener类的具体用法?Java DocumentListener怎么用?Java DocumentListener使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


DocumentListener类属于javax.swing.event包,在下文中一共展示了DocumentListener类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: SuiteCustomizerBasicBranding

import javax.swing.event.DocumentListener; //导入依赖的package包/类
/**
 * Creates new form SuiteCustomizerLibraries
 */
public SuiteCustomizerBasicBranding(final SuiteProperties suiteProps, ProjectCustomizer.Category cat, 
        BasicCustomizer.SubCategoryProvider prov) {
    super(suiteProps, SuiteCustomizerBasicBranding.class, cat);
    initComponents();        
    this.prov = prov;
    refresh(); 
    checkValidity();
    DocumentListener textFieldChangeListener = new UIUtil.DocumentAdapter() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            checkValidity();
        }
    };
    nameValue.getDocument().addDocumentListener(textFieldChangeListener);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:19,代码来源:SuiteCustomizerBasicBranding.java

示例2: BasicBrandingPanel

import javax.swing.event.DocumentListener; //导入依赖的package包/类
public BasicBrandingPanel(BrandingModel model) {
    super(NbBundle.getMessage(BasicBrandingPanel.class, "LBL_BasicTab"), model); //NOI18N
    initComponents();        
    refresh(); 
    checkValidity();
    DocumentListener textFieldChangeListener = new UIUtil.DocumentAdapter() {
        @Override
        public void insertUpdate(DocumentEvent e) {
            checkValidity();
            setModified();
            titleValueModified = true;
        }
    };
    titleValue.getDocument().addDocumentListener(textFieldChangeListener);
    titleValueModified = false;
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:17,代码来源:BasicBrandingPanel.java

示例3: ViewUpdates

import javax.swing.event.DocumentListener; //导入依赖的package包/类
public ViewUpdates(DocumentView docView) {
    this.docView = docView;
    incomingModificationListener = new IncomingModificationListener();
    Document doc = docView.getDocument();
    // View hierarchy uses a pair of its own document listeners and DocumentView ignores
    // document change notifications sent from BasicTextUI.RootView.
    // First listener - incomingModificationListener at DocumentListenerPriority.FIRST notifies the hierarchy
    // about incoming document modification.
    // Second listener is "this" at DocumentListenerPriority.VIEW updates the view hierarchy structure
    // according to the document modification.
    // These two listeners avoid situation when a document modification modifies line structure
    // and so the view hierarchy (which uses swing Positions for line view statrts) is inconsistent
    // since e.g. with insert there may be gaps between views and with removal there may be overlapping views
    // but the document listeners that are just being notified include a highlighting layer's document listener
    // BEFORE the BasicTextUI.RootView listener. At that point the highlighting layer would fire a highlighting
    // change and the view hierarchy would attempt to rebuild itself but that would fail.
    listenerPriorityAwareDoc = DocumentUtilities.addPriorityDocumentListener(doc, 
            WeakListeners.create(DocumentListener.class, incomingModificationListener, null),
            DocumentListenerPriority.FIRST);
    // Add the second listener in all cases.
    DocumentUtilities.addDocumentListener(doc,
            WeakListeners.create(DocumentListener.class, this, doc),
            DocumentListenerPriority.VIEW);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:ViewUpdates.java

示例4: addDocumentListener

import javax.swing.event.DocumentListener; //导入依赖的package包/类
public void addDocumentListener(DocumentListener listener) {
    if (listener == null) {
        return;
    }

    if (docListeners == null) {
        docListeners = new DocumentListener[1];
        docListeners[0] = listener;
    } else {
        DocumentListener[] oldArr = docListeners;
        docListeners = new DocumentListener[oldArr.length + 1];
        System.arraycopy(oldArr, 0,
                         docListeners, 0,
                         oldArr.length);
        docListeners[oldArr.length] = listener;
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:18,代码来源:OutputDocument.java

示例5: NameAndLocationPanel

import javax.swing.event.DocumentListener; //导入依赖的package包/类
/** Creates new NameAndLocationPanel */
public NameAndLocationPanel(final WizardDescriptor setting, final NewLibraryDescriptor.DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title",// NOI18N
            NbBundle.getMessage(NameAndLocationPanel.class,"LBL_LibraryWizardTitle")); // NOI18N
    
    DocumentListener dListener = new UIUtil.DocumentAdapter() {
        public void insertUpdate(DocumentEvent e) {
            NewLibraryDescriptor.DataModel _data = getTemporaryDataModel();                
            setEnabledForFilesInfo(checkValidity(_data));
            setFilesInfoIntoTextAreas(_data);
        }
    };
    libraryNameVale.getDocument().addDocumentListener(dListener);
    libraryDisplayNameValue.getDocument().addDocumentListener(dListener);        
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:20,代码来源:NameAndLocationPanel.java

示例6: NameIconLocationPanel

import javax.swing.event.DocumentListener; //导入依赖的package包/类
/** Creates new NameIconLocationPanel */
public NameIconLocationPanel(final WizardDescriptor setting, final DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title", getMessage("LBL_WizardWizardTitle"));
    DocumentListener updateListener = new UIUtil.DocumentAdapter() {
        public void insertUpdate(DocumentEvent e) {
            updateData();
        }
    };
    classNamePrefix.getDocument().addDocumentListener(updateListener);
    displayName.getDocument().addDocumentListener(updateListener);
    icon.getDocument().addDocumentListener(updateListener);        
    Component editorComp = packageName.getEditor().getEditorComponent();
    if (editorComp instanceof JTextComponent) {
        ((JTextComponent) editorComp).getDocument().addDocumentListener(updateListener);
    }
    if (category.getEditor().getEditorComponent() instanceof JTextField) {
        JTextComponent txt = (JTextComponent) category.getEditor().getEditorComponent();
        txt.getDocument().addDocumentListener(updateListener);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:NameIconLocationPanel.java

示例7: NameAndLocationPanel

import javax.swing.event.DocumentListener; //导入依赖的package包/类
/** Creates new NameAndLocationPanel */
public NameAndLocationPanel(final WizardDescriptor setting, final HTMLIterator.DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title", getMessage("LBL_TCWizardTitle"));
    
    DocumentListener dListener = new UIUtil.DocumentAdapter() {
        public void insertUpdate(DocumentEvent e) {
            if (checkValidity()) {
                updateData();
            }
        }
    };
    txtPrefix.getDocument().addDocumentListener(dListener);
    txtIcon.getDocument().addDocumentListener(dListener);
    
    if (comPackageName.getEditor().getEditorComponent() instanceof JTextField) {
        JTextField txt = (JTextField)comPackageName.getEditor().getEditorComponent();
        txt.getDocument().addDocumentListener(dListener);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:NameAndLocationPanel.java

示例8: NameAndLocationPanel

import javax.swing.event.DocumentListener; //导入依赖的package包/类
/** Creates new NameAndLocationPanel */
public NameAndLocationPanel(final WizardDescriptor setting, final NewTCIterator.DataModel data) {
    super(setting);
    this.data = data;
    initComponents();
    initAccessibility();
    putClientProperty("NewFileWizard_Title", getMessage("LBL_TCWizardTitle"));
    
    DocumentListener dListener = new UIUtil.DocumentAdapter() {
        public void insertUpdate(DocumentEvent e) {
            if (checkValidity()) {
                updateData();
            }
        }
    };
    txtPrefix.getDocument().addDocumentListener(dListener);
    txtIcon.getDocument().addDocumentListener(dListener);
    
    if (comPackageName.getEditor().getEditorComponent() instanceof JTextField) {
        JTextField txt = (JTextField)comPackageName.getEditor().getEditorComponent();
        txt.getDocument().addDocumentListener(dListener);
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:NameAndLocationPanel.java

示例9: initPanel

import javax.swing.event.DocumentListener; //导入依赖的package包/类
private void initPanel() {
    repositoryPanel = new RepositoryPanel();

    urlComboEditor = (JTextComponent) repositoryPanel.urlComboBox
                                      .getEditor().getEditorComponent();
    urlDoc = urlComboEditor.getDocument();
    usernameDoc = repositoryPanel.userTextField.getDocument();
    passwordDoc = repositoryPanel.userPasswordField.getDocument();
    tunnelCmdDoc = repositoryPanel.tunnelCommandTextField.getDocument();

    DocumentListener documentListener = new DocumentChangeHandler();
    urlDoc.addDocumentListener(documentListener);
    passwordDoc.addDocumentListener(documentListener);
    usernameDoc.addDocumentListener(documentListener);
    tunnelCmdDoc.addDocumentListener(documentListener);

    repositoryPanel.savePasswordCheckBox.addItemListener(this);
    repositoryPanel.urlComboBox.addItemListener(this);

    repositoryPanel.proxySettingsButton.addActionListener(this);

    repositoryPanel.userPasswordField.addFocusListener(this);

    tweakComboBoxEditor();
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:26,代码来源:Repository.java

示例10: createTextFieldLengthDocumentListener

import javax.swing.event.DocumentListener; //导入依赖的package包/类
/**
 * Listener updates label indicating remaining symbols number like in twitter.
 */
private static DocumentListener createTextFieldLengthDocumentListener(@NotNull TwitterDialogWrapper builder, @NotNull final StudyTwitterUtils.TwitterDialogPanel panel) {
  return new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      int length = e.getDocument().getLength();
      if (length > 140 || length == 0) {
        builder.setOKActionEnabled(false);
        panel.getRemainSymbolsLabel().setText("<html><font color='red'>" + String.valueOf(140 - length) + "</font></html>");
      } else {
        builder.setOKActionEnabled(true);
        panel.getRemainSymbolsLabel().setText(String.valueOf(140 - length));
      }

    }
  };
}
 
开发者ID:medvector,项目名称:educational-plugin,代码行数:20,代码来源:StudyTwitterUtils.java

示例11: AppEngineCloudConfigurable

import javax.swing.event.DocumentListener; //导入依赖的package包/类
public AppEngineCloudConfigurable(@NotNull AppEngineServerConfiguration configuration,
                                  @Nullable Project project, boolean alwaysRememberPassword) {
  myConfiguration = configuration;
  myProject = project;
  ActionListener actionListener = new ActionListener() {
    @Override
    public void actionPerformed(ActionEvent event) {
      updateControls();
    }
  };
  myPasswordLoginButton.addActionListener(actionListener);
  myOAuthLoginButton.addActionListener(actionListener);
  DocumentListener documentListener = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateControls();
    }
  };
  myEmailField.getDocument().addDocumentListener(documentListener);
  myPasswordField.getDocument().addDocumentListener(documentListener);
  myAlwaysRememberPassword = alwaysRememberPassword;
  updateControls();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AppEngineCloudConfigurable.java

示例12: GithubRepositoryEditor

import javax.swing.event.DocumentListener; //导入依赖的package包/类
public GithubRepositoryEditor(final Project project, final GithubRepository repository, Consumer<GithubRepository> changeListener) {
  super(project, repository, changeListener);
  myUrlLabel.setVisible(false);
  myUsernameLabel.setVisible(false);
  myUserNameText.setVisible(false);
  myPasswordLabel.setVisible(false);
  myPasswordText.setVisible(false);
  myUseHttpAuthenticationCheckBox.setVisible(false);

  myRepoAuthor.setText(repository.getRepoAuthor());
  myRepoName.setText(repository.getRepoName());
  myToken.setText(repository.getToken());
  myToken.setText(repository.getToken());
  myShowNotAssignedIssues.setSelected(!repository.isAssignedIssuesOnly());

  DocumentListener buttonUpdater = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      updateTokenButton();
    }
  };

  myURLText.getDocument().addDocumentListener(buttonUpdater);
  myRepoAuthor.getDocument().addDocumentListener(buttonUpdater);
  myRepoName.getDocument().addDocumentListener(buttonUpdater);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:GithubRepositoryEditor.java

示例13: HgTagDialog

import javax.swing.event.DocumentListener; //导入依赖的package包/类
public HgTagDialog(@NotNull Project project, @NotNull Collection<HgRepository> repositories, @Nullable HgRepository selectedRepo) {
  super(project, false);
  hgRepositorySelectorComponent.setTitle("Select repository to tag");
  DocumentListener documentListener = new DocumentAdapter() {
    @Override
    protected void textChanged(DocumentEvent e) {
      validateFields();
    }
  };

  tagTxt.getDocument().addDocumentListener(documentListener);

  setTitle("Tag");
  init();

  setRoots(repositories, selectedRepo);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:HgTagDialog.java

示例14: changedUpdate

import javax.swing.event.DocumentListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void changedUpdate(DocumentEvent e) {
    e = new DelegatingDocumentEvent(AutoCompleteDocument.this, e);

    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==DocumentListener.class) {
            // Lazily create the event:
            // if (e == null)
            // e = new ListSelectionEvent(this, firstIndex, lastIndex);
            ((DocumentListener)listeners[i+1]).changedUpdate(e);
        }
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:21,代码来源:AutoCompleteDocument.java

示例15: insertUpdate

import javax.swing.event.DocumentListener; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void insertUpdate(DocumentEvent e) {
    e = new DelegatingDocumentEvent(AutoCompleteDocument.this, e);

    // Guaranteed to return a non-null array
    Object[] listeners = listenerList.getListenerList();
    // Process the listeners last to first, notifying
    // those that are interested in this event
    for (int i = listeners.length-2; i>=0; i-=2) {
        if (listeners[i]==DocumentListener.class) {
            // Lazily create the event:
            // if (e == null)
            // e = new ListSelectionEvent(this, firstIndex, lastIndex);
            ((DocumentListener)listeners[i+1]).insertUpdate(e);
        }
    }
}
 
开发者ID:RockManJoe64,项目名称:swingx,代码行数:21,代码来源:AutoCompleteDocument.java


注:本文中的javax.swing.event.DocumentListener类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。