Java Code Examples for javax.swing.text.JTextComponent#addHierarchyListener()

The following examples show how to use javax.swing.text.JTextComponent#addHierarchyListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FileNameController.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void init() {

        Component cboxEditorComp = component.getEditor().getEditorComponent();
        fileNamePatternEditor = (JTextComponent) cboxEditorComp;
        fileNamePatternWatcher =
                new FileNamePatternWatcher(fileNamePatternEditor);
        fileNamePatternEditor.addFocusListener(fileNamePatternWatcher);
        fileNamePatternEditor.addHierarchyListener(fileNamePatternWatcher);
        fileNamePatternEditor.getDocument().addDocumentListener(
                new FileNameChangeListener());
        defaultColor = component.getForeground();
        component.setEditable(true);
        List<String> entries = FindDialogMemory.getDefault().getFileNamePatterns();
        if (!entries.isEmpty()) {
            component.setModel(new ListComboBoxModel<String>(entries, true));
        }
    }
 
Example 2
Source File: AnimationAutoCompletion.java    From 3Dscript with BSD 2-Clause "Simplified" License 4 votes vote down vote up
void addTo(JTextComponent tc) {
	tc.addFocusListener(this);
	tc.addHierarchyListener(this);
}