本文整理匯總了Java中javax.swing.text.Document.equals方法的典型用法代碼示例。如果您正苦於以下問題:Java Document.equals方法的具體用法?Java Document.equals怎麽用?Java Document.equals使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類javax.swing.text.Document
的用法示例。
在下文中一共展示了Document.equals方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: updateTexts
import javax.swing.text.Document; //導入方法依賴的package包/類
/** 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());
}
}
示例2: updateDefaultDirectory
import javax.swing.text.Document; //導入方法依賴的package包/類
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;
}
}
}
}
示例3: update
import javax.swing.text.Document; //導入方法依賴的package包/類
private void update(DocumentEvent evt) {
int index = browsersList.getSelectedIndex();
Document doc = evt.getDocument();
if (doc.equals(nameTextField.getDocument())) {
browsersModel.setBrowserName(index, nameTextField.getText());
}
}