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


Java JTextComponent.addPropertyChangeListener方法代码示例

本文整理汇总了Java中javax.swing.text.JTextComponent.addPropertyChangeListener方法的典型用法代码示例。如果您正苦于以下问题:Java JTextComponent.addPropertyChangeListener方法的具体用法?Java JTextComponent.addPropertyChangeListener怎么用?Java JTextComponent.addPropertyChangeListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在javax.swing.text.JTextComponent的用法示例。


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

示例1: AnnotationView

import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
/** Creates a new instance of AnnotationViewBorder */
public AnnotationView(JTextComponent pane/*, List/ *<MarkProviderCreator>* / creators*/) {
    this.pane = pane;
    // Set the name to be able to check for this component when "errorStripeOnly" property
    // is turned on for the pane in CustomizableSideBar.
    setName("errorStripe");
    
    repaintTask = WORKER.create(repaintTaskRunnable = new RepaintTask());
    this.data = new AnnotationViewDataImpl(this, pane);
    this.scrollBar = UIManager.getInsets("Nb.Editor.ErrorStripe.ScrollBar.Insets"); // NOI18N

    FoldHierarchy fh = FoldHierarchy.get(pane);
    fh.addFoldHierarchyListener(WeakListeners.create(FoldHierarchyListener.class, this, fh));
    pane.addPropertyChangeListener(WeakListeners.propertyChange(this, pane));

    updateForNewDocument();
    
    addMouseListener(this);
    addMouseMotionListener(this);
    
    setOpaque(true);
    
    setToolTipText(NbBundle.getMessage(AnnotationView.class,"TP_ErrorStripe"));
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:25,代码来源:AnnotationView.java

示例2: MasterMatcher

import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
private MasterMatcher(JTextComponent component) {
    this.component = component;
    if (component != null) {
        component.addPropertyChangeListener(new PropertyChangeListener() {
            @Override
            public void propertyChange(PropertyChangeEvent evt) {
                if ("document".equals(evt.getPropertyName())) {
                    synchronized (LOCK) {
                        // Cancel any pending task and clear the lastResult
                        if (task != null) {
                            task.cancel();
                            task = null;
                        }
                        if (lastResult != null) {
                            lastResult.cancel();
                            lastResult = null; // Prevent memory leak upon document change
                        }
                    }
                }
            }
        });
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:24,代码来源:MasterMatcher.java

示例3: TextLineNumber

import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
/**
 *	Create a line number component for a text component.
 *
 *  @param component  the related text component
 *  @param minimumDisplayDigits  the number of digits used to calculate
 *                               the minimum width of the component
 */
public TextLineNumber(JTextComponent component, int minimumDisplayDigits)
{
	this.component = component;

	setBackground(Color.white);
	setForeground(Color.GRAY);
	setCurrentLineForeground( new Color(58,142,186) );
	setBorderGap( 4 );
	setFont(new Font("Arial", Font.PLAIN, 10));
	setDigitAlignment( RIGHT );
	setMinimumDisplayDigits( minimumDisplayDigits );

	component.getDocument().addDocumentListener(this);
	component.addCaretListener( this );
	component.addPropertyChangeListener("font", this);
}
 
开发者ID:BlidiWajdi,项目名称:Mujeed-Arabic-Prolog,代码行数:24,代码来源:TextLineNumber.java

示例4: HyperlinkOperation

import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
/** Creates a new instance of HoveringImpl */
private HyperlinkOperation(JTextComponent component, String mimeType) {
    this.component = component;
    this.operationMimeType  = mimeType;
    this.oldComponentsMouseCursor = null;
    this.hyperlinkUp = false;
    this.listenersSetUp = false;
    
    readSettings();
    
    if (hyperlinkEnabled) {
        component.addPropertyChangeListener("document", this); // NOI18N
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:15,代码来源:HyperlinkOperation.java

示例5: ComponentPeer

import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
/** Creates a new instance of ComponentPeer */
    private ComponentPeer(JTextComponent pane) {
        this.pane = pane;
//        reschedule();
        pane.addPropertyChangeListener(this);
        pane.addCaretListener(this);
        pane.addAncestorListener(this);
        document = pane.getDocument();
        weakDocL = WeakListeners.document(this, document);
        document.addDocumentListener(weakDocL);

        ancestorAdded(null);
    }
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:14,代码来源:ComponentPeer.java

示例6: propertyChange

import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
@Override
public void propertyChange (PropertyChangeEvent evt) {
    // event for the editors tracker
    if (evt.getSource () == EditorRegistry.class) {
        if (evt.getPropertyName () == null || 
            EditorRegistry.FOCUS_GAINED_PROPERTY.equals (evt.getPropertyName ())
        ) {
            JTextComponent jtc = (JTextComponent) evt.getNewValue ();
            PropertyChangeListener l = (PropertyChangeListener) jtc.getClientProperty (DOCUMENT_TRACKER_PROP);
            if (l == null) {
                jtc.putClientProperty (DOCUMENT_TRACKER_PROP, documentListener);
                jtc.addPropertyChangeListener (documentListener);
            }
            myTask.schedule(100);
        }
        return;
    }

    // event for the document tracker
    if (evt.getSource () instanceof JTextComponent) {
        if (evt.getPropertyName () == null ||
            "document".equals (evt.getPropertyName ())
        ) { //NOI18N
            Document newDoc = (Document) evt.getNewValue ();
            if (newDoc != null) {
                myTask.schedule(100);
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:31,代码来源:EditorBookmarksModule.java

示例7: editorRegistryChanged

import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
private void editorRegistryChanged() {
    final JTextComponent editor = EditorRegistry.lastFocusedComponent();
    final JTextComponent lastEditor = lastEditorRef == null ? null : lastEditorRef.get();
    if (lastEditor != editor && (editor == null || editor.getClientProperty("AsTextField") == null)) {
        if (lastEditor != null) {
            lastEditor.removeCaretListener(this);
            lastEditor.removePropertyChangeListener(this);
            k24.set(false);
        }
        lastEditorRef = new WeakReference<JTextComponent>(editor);
        if (editor != null) {
            editor.addCaretListener(this);
            editor.addPropertyChangeListener(this);
        }
        final JTextComponent focused = EditorRegistry.focusedComponent();
        if (focused != null) {
            final Document doc = editor.getDocument();
            final String mimeType = DocumentUtilities.getMimeType (doc);
            if (doc != null && mimeType != null) {
                final Source source = Source.create (doc);
                if (source != null) {
                    ((EventSupport)SourceEnvironment.forSource(source)).resetState(true, false, -1, -1, true);
                }
            }
        }
    }
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:28,代码来源:EventSupport.java

示例8: AbbrevDetection

import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
private AbbrevDetection(JTextComponent component) {
    this.component = component;
    component.addCaretListener(this);
    doc = component.getDocument();
    if (doc != null) {
        listenOnDoc();
    }

    String mimeType = DocumentUtilities.getMimeType(component);
    if (mimeType != null) {
        mimePath = MimePath.parse(mimeType);
        prefs = MimeLookup.getLookup(mimePath).lookup(Preferences.class);
        prefs.addPreferenceChangeListener(WeakListeners.create(PreferenceChangeListener.class, this, prefs));
    }
    
    // Load the settings
    preferenceChange(null);
    
    component.addKeyListener(this);
    component.addPropertyChangeListener(this);
    
    surroundsWithTimer = new Timer(0, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
            // #124515, give up when the document is locked otherwise we are likely
            // to cause a deadlock.
            if (!DocumentUtilities.isReadLocked(doc)) {
                showSurroundWithHint();
            }
        }
    });
    surroundsWithTimer.setRepeats(false);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:33,代码来源:AbbrevDetection.java

示例9: setEditor

import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
/**
 * Resets the JTextComponent to <code>editor</code>. This will update
 * the tree accordingly.
 */
public void setEditor(JTextComponent editor) {
    if (this.editor == editor) {
        return;
    }

    if (this.editor != null) {
        Document oldDoc = this.editor.getDocument();

        oldDoc.removeDocumentListener(this);
        this.editor.removePropertyChangeListener(this);
        this.editor.removeCaretListener(this);
    }
    this.editor = editor;
    if (editor == null) {
        treeModel = null;
        tree.setModel(null);
    } else {
        Document newDoc = editor.getDocument();

        newDoc.addDocumentListener(this);
        editor.addPropertyChangeListener(this);
        editor.addCaretListener(this);
        treeModel = new ElementTreeModel(newDoc);
        tree.setModel(treeModel);
    }
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:31,代码来源:ElementTreePanel.java

示例10: installSearchFieldListener

import javax.swing.text.JTextComponent; //导入方法依赖的package包/类
protected static void installSearchFieldListener(final JTextComponent c) {
    c.addPropertyChangeListener(SEARCH_FIELD_PROPERTY_LISTENER);
}
 
开发者ID:SunburstApps,项目名称:OpenJSharp,代码行数:4,代码来源:AquaTextFieldSearch.java


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