gpt4 book ai didi

java - 如何用文本字段中给出的另一个单词替换所选单词?

转载 作者:行者123 更新时间:2023-12-02 04:48:44 24 4
gpt4 key购买 nike

我正在 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() );

关于java - 如何用文本字段中给出的另一个单词替换所选单词?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29447389/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com