Java Code Examples for javax.swing.text.Document#equals()

The following examples show how to use javax.swing.text.Document#equals() . 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: SetUpRemotePlatform.java    From netbeans with Apache License 2.0 6 votes vote down vote up
private void updateDefaultDirectory(DocumentEvent e) {
    Document doc = e.getDocument();
    if (doc.equals(username.getDocument())) {
        String usernameText = username.getText();
        if (!usernameText.isEmpty()) {
            String workdirText = workingDir.getText();
            if (workdirText.isEmpty() || (currentDefaultWorkDir != null && workdirText.equals(currentDefaultWorkDir))) {
                String updatedDefaultworkDir = "/home/" + usernameText + "/NetBeansProjects/"; //NOI18N
                workingDir.setText(updatedDefaultworkDir);
                currentDefaultWorkDir = updatedDefaultworkDir;
            }
        } else {
            if (currentDefaultWorkDir != null && workingDir.getText().equals(currentDefaultWorkDir)) {
                workingDir.setText(""); //NOI18N
                currentDefaultWorkDir = null;
            }
        }
    }
}
 
Example 2
Source File: PanelProjectLocationVisual.java    From netbeans with Apache License 2.0 6 votes vote down vote up
/** Handles changes in the Project name and project directory
 */
private void updateTexts(DocumentEvent e) {
    Document doc = e.getDocument();
    if (doc.equals(projectNameTextField.getDocument()) || doc.equals(projectLocationTextField.getDocument())) {
        // Change in the project name
        String projectName = projectNameTextField.getText();
        String projectFolder = projectLocationTextField.getText();
        String projFolderPath = FileUtil.normalizeFile(new File(projectFolder)).getAbsolutePath();
        if (projFolderPath.endsWith(File.separator)) {
            createdFolderTextField.setText(projFolderPath + projectName);
        } else {
            createdFolderTextField.setText(projFolderPath + File.separator + projectName);
        }
    }
    
    panel.fireChangeEvent(); // Notify that the panel changed        
    
    if (this.projectNameTextField.getDocument().equals(e.getDocument())) {
        firePropertyChange(PROP_PROJECT_NAME, null, this.projectNameTextField.getText());
    }
    if (this.projectLocationTextField.getDocument().equals(e.getDocument())) {
        firePropertyChange(PROP_PROJECT_LOCATION, null, this.projectLocationTextField.getText());
    }
}
 
Example 3
Source File: WebBrowsersOptionsPanel.java    From netbeans with Apache License 2.0 5 votes vote down vote up
private void update(DocumentEvent evt) {
    int index = browsersList.getSelectedIndex();
    Document doc = evt.getDocument();
    if (doc.equals(nameTextField.getDocument())) {
        browsersModel.setBrowserName(index, nameTextField.getText());
    } 
}