本文整理汇总了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());
}
}