如何用文本字段中给出的另一个词替换所选词?
How do I replace the selected word with another word given in the textfield?
我正在 NetBeans 中制作一个 java 应用程序,我希望方法 replaceAllActionPerformed()
将所选文本从 jTextPane 更改为在 jTextField 中编写的文本。我应该用 getText()
和 setText()
还是有其他方法吗?
I would like that the method replaceAllActionPerformed()changes the selected text from jTextPane to the text written in jTextField.
textPane.replaceSelection( textField.getText() );
我正在 NetBeans 中制作一个 java 应用程序,我希望方法 replaceAllActionPerformed()
将所选文本从 jTextPane 更改为在 jTextField 中编写的文本。我应该用 getText()
和 setText()
还是有其他方法吗?
I would like that the method replaceAllActionPerformed()changes the selected text from jTextPane to the text written in jTextField.
textPane.replaceSelection( textField.getText() );