javax.swing.text.StyledDocument.addDocumentListener()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(6.3k)|赞(0)|评价(0)|浏览(129)

本文整理了Java中javax.swing.text.StyledDocument.addDocumentListener()方法的一些代码示例,展示了StyledDocument.addDocumentListener()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。StyledDocument.addDocumentListener()方法的具体详情如下:
包路径:javax.swing.text.StyledDocument
类名称:StyledDocument
方法名:addDocumentListener

StyledDocument.addDocumentListener介绍

暂无

代码示例

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-visualweb-insync

  1. private void addDocumentListener() {
  2. if (styledDocument != null && documentListenerAdded.compareAndSet(false, true)) {
  3. styledDocument.addDocumentListener(this);
  4. }
  5. }

代码示例来源:origin: org.netbeans.modules/org-netbeans-modules-web-jsf

  1. public void propertyChange(PropertyChangeEvent evt) {
  2. StyledDocument doc = getDocument();
  3. if (EditorCookie.Observable.PROP_DOCUMENT.equals(evt.getPropertyName())
  4. && isDocumentLoaded() && doc != null) {
  5. doc.addDocumentListener(docListener);
  6. }
  7. }
  8. });

代码示例来源:origin: ontop/ontop

  1. private void prepareTextPane() {
  2. resetStyles();
  3. parent.setBorder(null);
  4. parent.getStyledDocument().addDocumentListener(
  5. new DocumentListener() {
  6. @Override public void insertUpdate(DocumentEvent e) { handleDocumentUpdated(); }
  7. @Override public void removeUpdate(DocumentEvent e) { handleDocumentUpdated(); }
  8. @Override public void changedUpdate(DocumentEvent e) { /* NO-OP */ }
  9. }
  10. );
  11. }

代码示例来源:origin: org.netbeans.api/org-openide-text

  1. /** Creates new LineListener */
  2. public LineListener(StyledDocument doc, CloneableEditorSupport support) {
  3. this.struct = new LineStruct();
  4. root = NbDocument.findLineRootElement(doc);
  5. orig = lines = root.getElementCount();
  6. this.support = support;
  7. doc.addDocumentListener(WeakListeners.document(this, doc));
  8. }

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

  1. /** Creates new LineListener */
  2. public LineListener (StyledDocument doc, CloneableEditorSupport support) {
  3. this.doc = doc;
  4. this.struct = new LineStruct ();
  5. root = NbDocument.findLineRootElement (doc);
  6. orig = lines = root.getElementCount ();
  7. this.support = support;
  8. doc.addDocumentListener(org.openide.util.WeakListeners.document (this, doc));
  9. }

代码示例来源:origin: Wimmics/corese

  1. @Override
  2. public void redo()
  3. {
  4. editor.getStyledDocument().addDocumentListener( this );
  5. super.redo();
  6. editor.getStyledDocument().removeDocumentListener( this );
  7. }

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. /** Creates new LineListener */
  2. public LineListener (StyledDocument doc, CloneableEditorSupport support) {
  3. this.doc = doc;
  4. this.struct = new LineStruct ();
  5. root = NbDocument.findLineRootElement (doc);
  6. orig = lines = root.getElementCount ();
  7. this.support = support;
  8. doc.addDocumentListener(org.openide.util.WeakListeners.document (this, doc));
  9. }

代码示例来源:origin: fr.inria.wimmics/kggui

  1. @Override
  2. public void redo()
  3. {
  4. editor.getStyledDocument().addDocumentListener( this );
  5. super.redo();
  6. editor.getStyledDocument().removeDocumentListener( this );
  7. }

代码示例来源:origin: net.sourceforge.jadex/jadex-runtimetools-swing

  1. doc.addDocumentListener(new DocumentListener()

代码示例来源:origin: org.activecomponents.jadex/jadex-runtimetools-swing

  1. doc.addDocumentListener(new DocumentListener()

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. public void run() {
  2. try {
  3. doc.removeDocumentListener(getListener());
  4. doc.remove(0, doc.getLength()); // remove all text
  5. doc.addDocumentListener(getListener());
  6. } catch(BadLocationException ble) {
  7. ErrorManager.getDefault().notify(
  8. ErrorManager.INFORMATIONAL, ble);
  9. }
  10. }
  11. });

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

  1. public void run() {
  2. try {
  3. doc.removeDocumentListener(getListener());
  4. doc.remove(0, doc.getLength()); // remove all text
  5. doc.addDocumentListener(getListener());
  6. } catch(BadLocationException ble) {
  7. ErrorManager.getDefault().notify(
  8. ErrorManager.INFORMATIONAL, ble);
  9. }
  10. }
  11. });

代码示例来源:origin: ontop/ontop

  1. public SQLQueryPainter(JTextPane parent) {
  2. this.doc = parent.getStyledDocument();
  3. this.parent = parent;
  4. prepareStyles();
  5. setupFont();
  6. prepareTextPane();
  7. docListener = new DocumentListener() {
  8. @Override
  9. public void insertUpdate(DocumentEvent e) {
  10. handleDocumentUpdated();
  11. }
  12. @Override
  13. public void removeUpdate(DocumentEvent e) {
  14. handleDocumentUpdated();
  15. }
  16. @Override
  17. public void changedUpdate(DocumentEvent e) {
  18. // NO-OP
  19. }
  20. };
  21. parent.getStyledDocument().addDocumentListener(docListener);
  22. timer = new Timer(200, new ActionListener() {
  23. public void actionPerformed(ActionEvent e) {
  24. handleTimer();
  25. }
  26. });
  27. }

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

  1. doc.addDocumentListener(getListener());

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. doc.addDocumentListener(getListener());

代码示例来源:origin: mars-sim/mars-sim

  1. terminal.getDocument().addDocumentListener(new DocumentListener() {
  2. @Override public void removeUpdate(DocumentEvent e) {choiceIndex = -1;}
  3. @Override public void insertUpdate(DocumentEvent e) {choiceIndex = -1;}

代码示例来源:origin: com.davidbracewell/hermes-core

  1. lines.setDisabledTextColor(Color.DARK_GRAY);
  2. lines.setFont(new Font(Font.MONOSPACED, Font.PLAIN, editorPane.getFont().getSize()));
  3. editorPane.getStyledDocument().addDocumentListener(new DocumentListener() {
  4. @Override
  5. public void changedUpdate(DocumentEvent de) {

代码示例来源:origin: org.netbeans.api/org-openide-text

  1. NbDocument.markError(doc, pos.getOffset());
  2. doc.addDocumentListener(docL = org.openide.util.WeakListeners.document(listener, doc));

代码示例来源:origin: net.sf.squirrel-sql.thirdpary-non-maven/openide

  1. /** Refreshes the current line.
  2. *
  3. * @deprecated since 1.20. */
  4. synchronized void refreshState () {
  5. StyledDocument doc = pos.getCloneableEditorSupport ().getDocument ();
  6. if (doc != null) {
  7. // the document is in memory, mark the state
  8. if (docL != null) {
  9. doc.removeDocumentListener (docL);
  10. }
  11. // error line
  12. if (error) {
  13. NbDocument.markError (doc, pos.getOffset ());
  14. doc.addDocumentListener (docL = org.openide.util.WeakListeners.document (listener, doc));
  15. return;
  16. }
  17. // current line
  18. if (current) {
  19. NbDocument.markCurrent (doc, pos.getOffset ());
  20. return;
  21. }
  22. // breakpoint line
  23. if (breakpoint) {
  24. NbDocument.markBreakpoint (doc, pos.getOffset ());
  25. return;
  26. }
  27. NbDocument.markNormal (doc, pos.getOffset ());
  28. return;
  29. }
  30. }

代码示例来源:origin: net.sf.squirrel-sql.thirdparty-non-maven/openide

  1. /** Refreshes the current line.
  2. *
  3. * @deprecated since 1.20. */
  4. synchronized void refreshState () {
  5. StyledDocument doc = pos.getCloneableEditorSupport ().getDocument ();
  6. if (doc != null) {
  7. // the document is in memory, mark the state
  8. if (docL != null) {
  9. doc.removeDocumentListener (docL);
  10. }
  11. // error line
  12. if (error) {
  13. NbDocument.markError (doc, pos.getOffset ());
  14. doc.addDocumentListener (docL = org.openide.util.WeakListeners.document (listener, doc));
  15. return;
  16. }
  17. // current line
  18. if (current) {
  19. NbDocument.markCurrent (doc, pos.getOffset ());
  20. return;
  21. }
  22. // breakpoint line
  23. if (breakpoint) {
  24. NbDocument.markBreakpoint (doc, pos.getOffset ());
  25. return;
  26. }
  27. NbDocument.markNormal (doc, pos.getOffset ());
  28. return;
  29. }
  30. }

相关文章