當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。